In PHP 5.2, how to get the last second in a day? time() + 86400 gets the next Day only?
+10
A:
echo date('r', strtotime('tomorrow') - 1);
returns 'Mon, 18 Jan 2010 23:59:59'
you need that deal with leap seconds (times such as 23:59:60
)
jspcal
2010-01-18 07:45:05
+1 for leap seconds
Thilo
2010-01-18 07:46:57
Leap second has no relevance here. For example, "2008-12-31 23:59:60" is the same as "2009-01-01 00:00:00". Quoting http://unix-time.com/ : "The Unix time number increases by exactly 86400 each day, regardless of how long the day is." and "When a leap second is inserted...the Unix time number increases continuously during the leap second...and then jumps down by 1 at the end of the leap second, which is the start of the next day."
GZipp
2010-01-18 12:49:09
GZipp, so you mean that my solution is also correct? :D Nice to learn about leap seconds though, I didn't know them earlier.
Emil Vikström
2010-01-22 09:26:12