#50048 [NEW]: Strtotime Last fails
| From: | arnbme at gmail dot com | Date: | Sun, 01 Nov 2009 14:12:21 +0000 |
| Subject: | #50048 [NEW]: Strtotime Last fails | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-144131@lists.php.net to get a copy of this message | ||
From: arnbme at gmail dot com
Operating system: Wamp or Linux
PHP version: 5.3.0
PHP Bug Type: Scripting Engine problem
Bug description: Strtotime Last fails
Description:
------------
the last option of strtotime seems to ignore the int $now parameter.
Reproduce code:
---------------
<?php
$br='<br>';
$mths =
array("","January","February","March","April","May","June","July","August","September","October","November","December");
$x = strtotime('2009-11-29'); //date to age
$Year = date("Y",$x);
$Month = date("m",$x);
if ($Month == 12){
$Year++;
$Month = 1;}
else
$Month++;
$n=strtotime($mths[$Month].' 01, '.$Year);
echo 'base date:',date("Y-m-d",$n),$br;
if ($n==false)
die ('bad date');
$nextdt=date( "Y-m-d",strtotime("last Sunday", $n));
echo 'Calc Last:',$nextdt,$br; //result is 2009-11-29 should be
2009-12-27
?>
Expected result:
----------------
Should show 2009-12-27
Actual result:
--------------
2009-11-29
--
Edit bug report at http://bugs.php.net/?id=50048&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50048&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50048&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50048&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50048&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50048&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50048&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50048&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50048&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50048&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50048&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50048&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50048&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50048&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50048&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50048&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50048&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50048&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50048&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50048&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50048&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50048&r=mysqlcfg