ID:               40977
 Updated by:       [EMAIL PROTECTED]
 Reported By:      srisamir at gmail dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         Date/time related
 Operating System: Windows 2003
 PHP Version:      4.4.6
 New Comment:

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




Previous Comments:
------------------------------------------------------------------------

[2007-04-02 14:04:10] 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


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40977&edit=1

Reply via email to