http://qs321.pair.com?node_id=258736


in reply to Re: Converting datetime string to valid localtime value (seconds)
in thread Converting datetime string to valid localtime value (seconds)

How do array indexes come into play when I'm only looking at this line of code:
localtime(Date_SecsSince1970($mon{$mon}, $d, $y, $h, $mn, $s))
If the values of $mon{$mon}, $d, $y, $h are valid (5, 15, 2003, 01 respectively), why the resulting datetime string returned by localtime() is in fact "Wed May 14 18:05:02 2003"?

Please note that I do not force localtime() to return datetime values in array format. What this line of code (and accompanying output) seem to indicate is that the Date_SecsSince1970() method miscalculates seconds or, to state it otherwise, calculates seconds in a way that is incompatible with how the time() method does it.

Afterall, print "time string: " . localtime(time()) would produce valid result.

_____________________
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce
the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true."

Robert Wilensky, University of California