strtotime( 'last Sunday' ) and republicans
| From: | Greg Donald | Date: | Tue, 11 Mar 2008 01:41:32 +0000 |
| Subject: | strtotime( 'last Sunday' ) and republicans | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-271243@lists.php.net to get a copy of this message | ||
Hey Rob,
Remember on 2007-09-18 at 22:45:37 when you suggested I do this:
http://marc.info/?l=php-general&m=119015558426248&w=2
Well.. today strtotime( 'last Sunday' ) screwed me and I'm writing to
say that I nearly fell out of my chair laughing when I realized what
the problem was, who caused it, and who "helped" me code it. :)
This issue only appears on an ancient PHP4 install as far as I can tell:
echo "Current time():\n";
echo date( 'Y-m-d H:i:s', time() );
echo "\nBroken strtotime( 'last Sunday' )\n";
echo date( 'Y-m-d H:i:s', strtotime( 'last Sunday' ) );
echo "\n";
> /usr/local/php4/bin/php test.php
Current time():
2008-03-10 20:03:39
Broken strtotime( 'last Sunday' )
2008-03-08 23:00:00
23:00? Guess what we did to out clocks this past weekend?
I blame the republicans in general, and the short one named 'W' specifically.
I won't bother mentioning the fix as I'm sure 83,293,874,713 people
will post the same correct code by the end of the day tomorrow. No
one runs PHP4 except _my_ clients anyway. *shrug*
--
Greg Donald
http://destiney.com/