From: jason dot young at daystar dot com
Operating system: win 2003 IIs 6
PHP version: 5.2.5
PHP Bug Type: Date/time related
Bug description: Problems with strtotime or strftime and DST
Description:
------------
Ok I'm trying to do some calendar work right during this summers time
change hour. 3/9/2008 at 2 a.m. I work for a television network and we have
to created scheduals for every hour of every day. (This includes 2 am)
strtotime or possibly strftime is not handling that 2:00 am hour correctly
here is some testing:
Reproduce code:
---------------
<?php
echo(strftime("%a %m/%d/%y %I:%M %p",(strtotime("3/9/2008 2:00:00 AM"))));
echo " --- ";
echo(strftime("%m/%d/%y %I:%M %p",(strtotime("Mar 9 2008 2:00AM"))));
echo " --- ";
echo(strtotime("-2 days ",strtotime("03/09/08")));
echo " --- ";
echo(strtotime("-2 days ", 1205042400));
echo " --- ";
echo(strtotime("3/9/2008 2:00:00 AM"));
echo " --- ";
echo(strtotime("Mar 9 2008 2:00AM"));
?>
Output:
Sun 03/09/08 03:00 AM --- 03/09/08 03:00 AM --- 1204869600 --- 1204869600
--- 1205049600 --- 1205049600
I've tried setting the TZ to US/CDT that didn't help ($test =
putenv("TZ=US/CDT");)
Expected result:
----------------
I expect the code to return a formated verson of the date "Mar 9 2008
2:00AM"
Actual result:
--------------
Sun 03/09/08 03:00 AM
I apologize in advance if this is my misuse.
--
Edit bug report at http://bugs.php.net/?id=44176&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44176&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44176&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44176&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44176&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44176&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44176&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44176&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44176&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44176&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44176&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44176&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44176&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44176&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44176&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44176&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44176&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44176&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44176&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44176&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44176&r=mysqlcfg