php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50619 date change year
Submitted: 2009-12-31 11:26 UTC Modified: 2009-12-31 12:15 UTC
From: klevisi at gmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.12 OS: linux
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: klevisi at gmail dot com
New email:
PHP Version: OS:

 

 [2009-12-31 11:26 UTC] klevisi at gmail dot com
Description:
------------
When the year changes it displays not the expected results

Reproduce code:
---------------
<?php
for($i=0; $i<7; $i++) {
    echo date("o-m-d", mktime() + $i * 86400);
    echo '<br />';
}
?>

Expected result:
----------------
2009-12-31
2010-01-01
2010-01-02
2010-01-03
2010-01-04
2010-01-05
2010-01-06

Actual result:
--------------
2009-12-31
2009-01-01
2009-01-02
2009-01-03
2010-01-04
2010-01-05
2010-01-06

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-12-31 12:15 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

The \"o\" specifier is for the \"ISO Year\", see http://en.wikipedia.org/wiki/ISO_year#Relation_with_the_Gregorian_calendar for what that means. You probably want to use \"Y\" instead.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 11:01:33 2025 UTC