ID:               28594
 Updated by:       [EMAIL PROTECTED]
 Reported By:      tavancini at hotmail dot com
 Status:           Open
 Bug Type:         Date/time related
 Operating System: Windows 2000 Server
 PHP Version:      4.3.6
 New Comment:

H'mm, let's see, on 31-May:

-11months = 31-June, which doesn't exist so is treated as 01-July
-10months = 31-July (fine)
-9 months = 31-August (fine)
-8 months = 31-September (doesn't exist, treat as 01-Oct)
-7 months = 31-October (fine)
-6 months = 31-November (doesn't exist, treat as 01-Dec)

etc.

Not a PHP bug.


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

[2004-06-01 18:30:18] tavancini at hotmail dot com

Hi,

The script is the same as I posted.

Only a comment, when i change the server date to May 30, or, May 31..
the script goes crazy and reproduce the error as i mentioned.

BUT, today, June 1st, the script goes normally as i programmed.

Strange thing...

for information, i am using...
English Windows 2000 Server - Service Pack 3
Locale "Portugues (Brazil)
Short Date Format "d/M/yyyy"
(GMT -03:00) - Brasilia

Thanks.

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

[2004-06-01 08:19:53] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.

Works for me, come up with a better script which also takes care of
timezones etc.

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

[2004-06-01 07:30:53] jed at jed dot bz

Better demonstration:

for($x = 12; $x >= 1; $x--)
    echo date("m/Y", strtotime(sprintf("$x month%s ago",
        $x == 1 ? '' : 's'))) . "\n";

Odd assortment of dates.

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

[2004-05-31 23:17:45] tavancini at hotmail dot com

Description:
------------
strtotime not calculating actual date subtraction

Reproduce code:
---------------
<?
echo date( "m/Y", strtotime("-11 month") ) . "<br><br>";
echo date( "m/Y", strtotime("-10 month") ) . "<br><br>";
?>

Expected result:
----------------
07/2003
08/2003

Actual result:
--------------
07/2003
07/2003


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


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

Reply via email to