On Sun, 20 Nov 2011, Tedd Sperling wrote:
I appreciate your time and comments. However, you missed the point I was
trying to make, which does not have anything to do with timezones. If
you copy my code and place it on any server in the world, you'll observe
the same results as I did.
NO I won't, and timezones do matter.
I've copied your code to http://quitelikely.com/~geoff/strtotime/
Sorry if any of the visuals are mangled, I had to massage the script a
little to pullin the header and footer, and I downloaded your logo, but I
didn't go and dig out your CSS or javascript.
This server is set to UTC and uses PHP 5.2.6.
Lets skip right to your point.
From your script on your server:
String Given: null
Seconds Computed from String: null
Date from Seconds Computed: 31 December, 1969 : Wednesday
___________________________________________________________________________
From the script on my server:
String Given: null
Seconds Computed from String: null
Date from Seconds Computed: 1 January, 1970 : Thursday
__________________________________________________________________
You touched on my point with:
You'll also notice that the value of seconds computed from string is
blank (i.e. not 0). This is because strtotime() doesn't know what to
do with a value of '0'. Whether it should or not is probably a
phillosophical debate.
But you did not contribute to which side of the debate would you side.
I didn't, because the debate was on whether or not NULL == Wednesday, not
whether or not strtotime("0") should return 0. I agree there's a good
case for it doing so, you could file a bug if you feel strongly about it.
My prior opinion was that 0 should return 'Jan 1, 1970'. However, Stuart
pointed out a flaw in my code. You see, I was assuming that using the
return from strtotime(0) in the getdate() function would return the
correct date, but this was a cascade error.
As I think I mentioned before, using strtotime at all is the problem, as
we are talking about null as a concept, not "null" the alphabetical
string. Since null is nominally a numerical value, we can pass it
directly as a timestamp.
php -r 'echo date("r", null);'
Thu, 01 Jan 1970 00:00:00 +0000
Geoff.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php