From: xojins at gmail dot com
Operating system: RedHat EL5
PHP version: 5.3.23
Package: Date/time related
Bug Type: Bug
Bug description:DATE Day of Week bug for 3-10-2013
Description:
------------
When using the DATE function and returning the day of the week (lowercase L
format) returns the wrong day of the week for 3/10/2013.
The example provided shows subtracting 86400 seconds from
strtotime('03/11/2013')
to return 1362888000 seconds. When passed to DATE, it returns Saturday.
This is
wrong and should be Sunday.
You need to add 3600 to any value to calculate 3/10/13 correctly.
Test script:
---------------
$d1 = date('l', strtotime('03/12/2013')-(60*60*24)); //date('l',
1363060800 - 86400) = date('l', 1362974400) = Monday
$d2 =date('l', strtotime('03/11/2013')-(60*60*24)); //date('l', 1362974400
- 86400) = date('l', 1362888000) = Saturday != date('m-d-y', 1362888000)
$d3 =date('l', strtotime('03/10/2013')-(60*60*24)); //date('l', 1362891600
- 86400) = date('l', 1362805200) = Saturday
echo $d1 . '<br>';
echo $d2 . '<br>';
echo $d3 . '<br>';
Expected result:
----------------
Monday
Sunday
Saturday
Actual result:
--------------
Monday
Saturday
Saturday
--
Edit bug report at https://bugs.php.net/bug.php?id=64448&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=64448&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=64448&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=64448&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64448&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64448&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64448&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64448&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64448&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64448&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64448&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64448&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64448&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64448&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64448&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64448&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64448&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64448&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64448&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64448&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64448&r=mysqlcfg