|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40977 strftime failed on 2nd April 2007
Submitted: 2007-04-02 14:04 UTC Modified: 2007-04-11 01:00 UTC
From: srisamir at gmail dot com Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 4.4.6 OS: Windows 2003
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: srisamir at gmail dot com
New email:
PHP Version: OS:


 [2007-04-02 14:04 UTC] srisamir at gmail dot com
I tried the smarty function format_date to format a date-time(yyyymmddhhmmss). 
It was working till last Saturday. Today, Monday when I tried the same, it was showing wrong date(like 16 Jul, 98 00:00:00).
But when I changed the system date(say, 1st April or 3rd April) the output date string was correct.

I went inside the smarty function and try to reproduce the result. 
I used the function strftime to format the date-time and got the same error (wrong display for 2nd April, 2007).  

I tried with other dates (say 20070403181644) and got correct display.

Reproduce code:
$string = "20070402181644"; //"20070403181644"
$time = strtotime($string);
if (is_numeric($time) && $time != -1) {}
else {
    $time = mktime(substr($string,8,2),substr($string,10,2),substr 
            ($string,12,2), substr($string,4,2),
            substr ($string,6,2),substr($string,0,4));
echo strftime("%d,%b,%Y", $time);

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-03 18:43 UTC]
Please try using this CVS snapshot:
For Windows:

 [2007-04-11 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Aug 01 14:01:24 2021 UTC