php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30678 strtotime() has problems with Halloween
Submitted: 2004-11-03 20:27 UTC Modified: 2004-11-03 20:58 UTC
From: alexbo at delphian dot org Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.0.1 OS: RedHat 9 (Kernel 2.4.20-20.9smp)
Private report: No CVE-ID: None
 [2004-11-03 20:27 UTC] alexbo at delphian dot org
Description:
------------
Halloween, according to strtotime(), is both Sunday and Monday this year. I haven't checked other years, but I just ran into this.

Uh... that's all I've got for you.

Reproduce code:
---------------
echo("<p>");
echo(date("d_M_y",mktime(0,0,0,10,30,04)));
echo("</p><p>");
echo(date("d_M_y",strtotime("tuesday",mktime(0,0,0,10,30,04))));
echo("</p><p>");
echo(date("d_M_y",strtotime("monday",mktime(0,0,0,10,30,04))));
echo("</p><p>");
echo(date("d_M_y",strtotime("sunday",mktime(0,0,0,10,30,04))));
echo("</p>");

Expected result:
----------------
30_Oct_04

02_Nov_04

01_Nov_04

31_Oct_04

Actual result:
--------------
30_Oct_04

01_Nov_04

31_Oct_04

31_Oct_04

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-03 20:58 UTC] derick@php.net
We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 05 17:01:31 2024 UTC