ID:               50059
 Updated by:       j...@php.net
 Reported By:      herrnoel at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Linux/Debian 5.0.3
 PHP Version:      5.2.11
 New Comment:

1. Too old and wrong PHP version. (we only support what we release, not
some badly patched binaries from 3rd party)

2. This is not a bug, strotime() is not an AI which can parse any crap
you pass it. Please ask support on the right forum.


Previous Comments:
------------------------------------------------------------------------

[2009-11-03 03:19:01] herrnoel at gmail dot com

Description:
------------
Actual php version is latest from debian stable: PHP 5.2.6-1+lenny3

When using strtotime() for some really handy english parsing, it works
great EXCEPT for the first day of the month.

The format is as follows:

[1-4] [day of week] [month] [year]

If the day of the week is the first day of the month, this will return
the date starting one week ahead of the first day of the month.
Otherwise, the behavior is as expected.

This is repeatable for all months.  If you leave out the initial digit,
the broken first day of the month works, but then you must use 1 to
indicate the 2nd instance of that day and so on.

Reproduce code:
---------------
echo date('Y-m-d', strtotime('1 thu oct 2009')); # first day of month
echo date('Y-m-d', strtotime('1 fri oct 2009')); # second day of month
echo date('Y-m-d', strtotime('1 sun nov 2009')); # first day of month
echo date('Y-m-d', strtotime('2 sun nov 2009')); # second sunday of
month (sunday is the first day of month)


Expected result:
----------------
2009-10-01
2009-10-02
2009-11-01
2009-11-08


Actual result:
--------------
2009-10-08
2009-10-02
2009-11-08
2009-11-15


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=50059&edit=1

Reply via email to