Req #51188 [NEW]: strtotime - last dayofweek of the month feature request
| From: | kbush at workforcerx dot org | Date: | Tue, 02 Mar 2010 23:58:46 +0000 |
| Subject: | Req #51188 [NEW]: strtotime - last dayofweek of the month feature request | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-148186@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows 2003
PHP version: 5.2.13
Package: Date/time related}
Bug Type: Feature/Change Request
Bug description:strtotime - last dayofweek of the month feature request
Description:
------------
I was attempting to strtotime to find the last (specific) day of the
month.
Example: Last Monday of May
But it returns false. I ended up taking a different approach but this would
have
been a nice feature.
Also tried: Last Monday April
Which did not return the results I was expecting.
Maybe we can get a little more documentation on this function and what
terms it
accepts? (If this exists, I was unable to find it)
Test script:
---------------
$f = "Y-m-d";$now = 1267571715; // 2010-03-02
echo "<pre>";
echo date($f, strtotime("last Monday",$now))."\n";
echo date($f, strtotime("last Monday in March",$now))."\n";
echo date($f, strtotime("last Monday of March",$now))."\n";
echo date($f, strtotime("last Monday April",$now))."\n";
echo date($f, strtotime("last Monday in April",$now))."\n";
echo date($f, strtotime("last Monday of April",$now))."\n";
echo "</pre>";
Expected result:
----------------
2010-03-01
2010-03-29
2010-03-29
2010-04-26
2010-04-26
2010-04-26
Actual result:
--------------
2010-03-01 (ok)
1969-12-31 (nothing returned)
1969-12-31 (nothing returned)
2010-03-29 (unexpected, but valid)
1969-12-31 (nothing returned)
1969-12-31 (nothing returned)
--
Edit bug report at http://bugs.php.net/bug.php?id=51188&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=51188&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=51188&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=51188&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=51188&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=51188&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=51188&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=51188&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=51188&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=51188&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=51188&r=support
Expected behavior: http://bugs.php.net/fix.php?id=51188&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=51188&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=51188&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=51188&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=51188&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=51188&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=51188&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=51188&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=51188&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=51188&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=51188&r=mysqlcfg