php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68758 strftime give wrong year if new year begins in the same week.
Submitted: 2015-01-06 11:10 UTC Modified: 2015-01-06 11:59 UTC
From: gareth at venditor dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.5.20 OS: Linux/OS-X etc
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gareth at venditor dot com
New email:
PHP Version: OS:

 

 [2015-01-06 11:10 UTC] gareth at venditor dot com
Description:
------------
If you run strftime() on a date in the last week of a year (e.g. 30 December 2014), and  the new year begins in the same week, the outputted date is "30 Dec 2015".

Test script:
---------------
<?php

$tmpTime = 1419937605; // 30 Dec 2014

var_dump(strftime('%e %b %G (%a)', $tmpTime));


Expected result:
----------------
string(17) "30 Dec 2014 (Tue)"

Actual result:
--------------
string(17) "30 Dec 2015 (Tue)"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-06 11:59 UTC] derick@php.net
-Status: Open +Status: Not a bug
 [2015-01-06 11:59 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 "year of the ISO week number". December 30 is in week 1 of ISO year 2015. You want %Y.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 03:00:02 2026 UTC