date change year bug

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

date change year bug

Post by klevis miho »

This code:

Code: Select all

<?php
for($i=0; $i<7; $i++) {
    //should print today and 6 days after
    echo date("o-m-d", mktime() + $i * 86400);
    echo '<br />';
}
?>
Prints:

Code: Select all

2009-12-31
2009-01-01
2009-01-02
2009-01-03
2010-01-04
2010-01-05
2010-01-06

Is this a bug?
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

Re: date change year bug

Post by manojsemwal1 »

hun if u use 'y' replace of 'o' it would be correct format..
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: date change year bug

Post by klevis miho »

You are right thnx.
I posted this as a bug at php.net :$
Post Reply