What is a good way to subtract two military times.
like how many hour and minutes are between 15:30:00 and 18:20:00.
thanks
Convert the two times to milliseconds, subtract them, and then reassemble that number into HH:MM:SS format.
I don't know if that's the "best" way to do it, but it is a way to do it. 🙂
are they both values in a database or are you just doing this in a script? If in a DB, let the DB do it.
I have done it in the database with SEC_TO_TIME(TIME_TO_SEC(time1) - TIME_TO_SEC(time2)) and this works perfect. I was just looking for a php way that was just as simple and efficient.