php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36763 Strftime bug
Submitted: 2006-03-16 21:28 UTC Modified: 2006-03-16 21:34 UTC
From: nath2 dot munier at free dot fr Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.4.2 OS: Mandrake10
Private report: No CVE-ID: None
 [2006-03-16 21:28 UTC] nath2 dot munier at free dot fr
Description:
------------
After some incomprehensible bug, I focus on this test:

Any explanation ?

Reproduce code:
---------------
<?

$TmpYear = 2005;

$TestTs = mktime(0, 0, 0, 1, 2, $TmpYear);
echo "<br>Comp : ".strftime("%d %B %G %T", $TestTs);
echo "<br>jour : ".strftime("%d", $TestTs);
echo "<br>mois : ".strftime("%m", $TestTs);
echo "<br>anne : ".strftime("%G", $TestTs);
$TestTs = mktime(0, 0, 0, 1, 3, $TmpYear);
echo "<br>Comp : ".strftime("%d %B %G %T", $TestTs);
echo "<br>jour : ".strftime("%d", $TestTs);
echo "<br>mois : ".strftime("%m", $TestTs);
echo "<br>anne : ".strftime("%G", $TestTs);
?>



Expected result:
----------------
2005 for both for the year.

Actual result:
--------------
2004 for 1rst of january.
2005 for third january.
Same problem with 1999

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-16 21:34 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

%G is the ISO year, not the "real" year. See http://no.php.net/strftime
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon May 18 09:00:02 2026 UTC