php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53654 translate epoch time to wrong date time
Submitted: 2011-01-04 19:38 UTC Modified: 2011-01-04 19:43 UTC
From: benjaminlin1019 at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3SVN-2011-01-04 (snap) OS: linux and mac
Private report: No CVE-ID: None
 [2011-01-04 19:38 UTC] benjaminlin1019 at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.strftime#Description
---
$date = strftime("%G-%m-%d", 1293868800 );
print $date . "\n";
output: 2010-01-01 

it should be 2011-01-01

Expected result:
----------------
2011-01-01

Actual result:
--------------
2010-01-01

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-04 19:43 UTC] rasmus@php.net
-Status: Open +Status: Bogus
 [2011-01-04 19:43 UTC] rasmus@php.net
You are confusing ISO-8601:1988 years and calendar years.  Jan 1, 2011 is actually 
in ISO-8601 year 2010.  You want %Y instead of %G here.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 10:01:30 2025 UTC