On Nov 17, 2011, at 7:59 PM, Stuart Dallas wrote: > On 17 Nov 2011, at 20:17, Tedd Sperling wrote: >> On Nov 17, 2011, at 11:58 AM, Stuart Dallas wrote: >>> "defined as the number of seconds elapsed since midnight Coordinated >>> Universal Time (UTC) of Thursday, January 1, 1970 (Unix times are defined, >>> but negative, before that date)" [http://en.wikipedia.org/wiki/Unix_time] >> >> Good reference to support your point, but strtotime() doesn't qork that way. >> In addition, the statement does not address where the fractions of a second >> were that occurred before the completion of the first second, clearly those >> fractions occurred in 1970. > > It certainly does address that. The definition "the number of seconds > elapsed" says nothing about whole seconds, so I'd venture that fractions of a > second are still covered.
Good -- I'm glad we agree. >>>> For example, if you push '-1' though strtotime(-1), you'll get Wednesday >>>> only one day a week -- whereas 'null' works every time. >>> Technically I see that as a bug. I believe strtotime(null) should return >>> null, but due to the way type inference works, null is interpreted as 0. >>> The point here being that you're not getting the time at null, you're >>> getting the time at 0. >> >> Nope, zero time is absolutely January 1, 1970 00:00:00 -- which was a >> Thursday. If you pass zero through strtotime(), it reports "December 1969" >> and I claim that to be a bug. Realize that seconds, minutes, and hours go >> from 0-59, not 1 to 60. Any fractions of a second before zero was 59.999... >> and such was indeed part of the day/month/year before. > > That has nothing to do with seconds running from 0 to 59 rather than 1 to 60, > it has to do with your timezone. When you ask PHP to display a formatted date > with a timestamp of 0 you're actually getting the time at (unix timestamp 0 + > (3600 * your timezone offset in hours)). Since you're in a timezone that's > behind UTC you get the previous day. > -snip- with other time zone discussion that have nothing to do with what I > observed nor addressed in my post. My observations are demonstrated here: http://www.webbytedd.com/cccc/strtotime/index.php Please note that regardless of time zone, the strtotime() function works (or at least it does for me) such that: If you enter '-1', the function will report back Todays Date with current seconds. Note there is no difference between entering 'Today' or '-1'. If you enter '0', the function will report back December, 31, 1969. If you enter nothing (i.e., null), then it reports back December, 31, 1969. It's clear (and by definition) that unix zero time (i.e., 00:00:00) happened in 1970. It's also clear that time before unix zero happened before 1970 (i.e., 'December 31, 1969'). As such, null (and not the string 'null' as stated my someone else, duh) should come back as "undefined" OR "December, 31, 1969". Furthermore, the string '-1' should default to '-1 second' instead of being the same as if I entered 'Today'. Now, where are my observations wrong? The code is shown in the demo. Cheers, tedd _____________________ t...@sperling.com http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php