php.net |  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2007-04-02 14:04 UTC] srisamir at gmail dot com
Description:
------------
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:
---------------
error_reporting(E_ALL);
$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:
----------------
02,Apr,2007

Actual result:
--------------
08,Mar,2006

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-03 18:43 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 08:01:28 2024 UTC