NYCPHP Meetup

NYPHP.org

[nycphp-talk] strtotime() Bug?

Brian Dailey support at dailytechnology.net
Mon Jan 8 11:31:32 EST 2007


Have you guys ran into this? I'm using strtotime('first monday january 
2007'), but I'm getting erroneous dates when the first day of that week 
occurs on the first of the month.

Examples:
date('Y-m-d', strtotime('second monday january 2007'));
date('Y-m-d', strtotime('second tuesday february 2007'));

Output Expected:
2007-01-08
2007-02-08

Actual Output:
2007-01-15
2007-02-15

The bug is in the PHP bug tracker here:
http://bugs.php.net/40003

But, alas, the bug has been marked as "bogus", although the problem is 
apparently unresolved. Is there a workaround for this, or am I doing 
something wrong?

Thanks guys!
- Brian



More information about the talk mailing list