php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41841 strtotime() with year + comma before month+day yields time 72420 secs dif
Submitted: 2007-06-28 15:29 UTC Modified: 2007-06-28 16:48 UTC
Votes:3
Avg. Score:3.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (66.7%)
From: wc_robot at yahoo dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.3 OS: Linux/Unix
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wc_robot at yahoo dot com
New email:
PHP Version: OS:

 

 [2007-06-28 15:29 UTC] wc_robot at yahoo dot com
Description:
------------
The year and comma placed before the month and day return a timestamp that is 72,420 seconds (~20+ hours) later than the value returned when the year comes after the month and date.




Reproduce code:
---------------
Example #1:
<?php echo strtotime('2007, Feb 1').' '.strtotime('Feb 1, 2007'); ?>
Return: 1170382020 1170309600
(and 1170382020 - 1170309600 = 72420)

Example #2:
<?php echo strtotime('2007, Jun 28').' '.strtotime('Jun 28, 2007'); ?>
Return: 1183079220 1183006800
(and 1183079220 - 1183006800 = 72420)

Expected result:
----------------
I expect the two values in each different example to yield the same timestamp.

Actual result:
--------------
The values are always 72,420 seconds different

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-28 16:48 UTC] derick@php.net
This is not a bug. Stand alone "2007" could either mean "the year 2007" or 20h07m. In case it is standalone the parser assumes the latter. As MMM dd, YYYY is a common format, there is an exception made. Changing this could possible break applications, so we can not do that.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 07:00:02 2026 UTC