From: jennifer dot kimball at nrc dot ca Operating system: Solaris 10 PHP version: 5.3.1 PHP Bug Type: Date/time related Bug description: ordinal month days don't work
Description: ------------ It appears impossible to write an expression that will generate the Nth day of any month (except for first or last days). Expressions like "third day of next month" fail in date_create(). Expressions like "next month +3 days" increment the month number and add 3 days to the current day number. Expressions like "first day of next month +2 days" give just the first day of the month. Reproduce code: --------------- //today is Nov 20, 2009 $d1=date_create('third day of next month'); print_r(DateTime::getLastErrors()); //errors echo 'd1: ',$d1->format('Y-m-d'); //nothing output $d2=date_create('first day of next month'); echo 'd2: ',$d2->format('Y-m-d'); //2009-12-01, works as expected $d3=date_create('first day of next month +2 days'); echo 'd3: ',$d3->format('Y-m-d'); //2009-12-01, not 2009-12-03 $d4=date_create('next month +3 days'); echo 'd4: ',$d4->format('Y-m-d'); //2009-12-23, also not 2009-12-03 though I can understand why Expected result: ---------------- Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 0 [errors] => Array ( ) ) d1: 2009-12-03 d2: 2009-12-01 d3: 2009-12-03 d4: 2009-12-23 Actual result: -------------- Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [10] => The timezone could not be found in the database ) ) d1: d2: 2009-12-01 d3: 2009-12-01 //still the 1st, 2 days not added d4: 2009-12-23 -- Edit bug report at http://bugs.php.net/?id=50249&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50249&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50249&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50249&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50249&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50249&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50249&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50249&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50249&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50249&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50249&r=support Expected behavior: http://bugs.php.net/fix.php?id=50249&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50249&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50249&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50249&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50249&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50249&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50249&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50249&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50249&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50249&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50249&r=mysqlcfg