Difference between dates

Posted by Ben C on Stack Overflow See other posts from Stack Overflow or by Ben C
Published on 2010-03-28T18:00:11Z Indexed on 2010/03/28 18:03 UTC
Read the original article Hit count: 346

Filed under:
|
|
|

I want to calculate the difference between two times, one of which is the current time, and the other is just in the format HH:MM, always in the future.

If I just subtract $futuretime from $now, it should, of course, be a positive number.

This works fine until...

If $now is in the afternoon or evening and $futuretime is, say, 7AM next morning, how can I force it to understand the the time is always going to be in the future?

(It's for working out the time of something that occurs about every half an hour during working hours, and then stops until the following morning)

Thanks in advance!

© Stack Overflow or respective owner

Related posts about time

Related posts about timestamp