Here's an example:
Find the elapsed time from 2 AM to 3 PM
If I didn't write "AM" or "PM", then it's not clear if I'm talking morning or afternoon. The initial reaction would simply be to subtract to get 3-2 = 1 hour. However, the correct answer is 13 hours. This is because it's 12 hours to go from 2 AM to 2 PM, then there's an additional hour to get to 3 PM.
This is probably why military time is better. Instead of saying "3 PM" we could say "15:00" which may be a bit confusing at first, but it's much clearer we mean the afternoon version of 3 o'clock. If you're not familiar with military time, then you subtract 15 - 12 = 3. So that's why "15:00" represents "3 PM".
If I said "find the duration from 03:00 to 15:00", then there is no need to use AM or PM. However, military time is probably something not everyone is familiar with, so it's probably best to stick to AM and PM.