Bug #76038 [NEW]: strtotime returning wrong date on -1 month

From: Date: Thu, 01 Mar 2018 14:28:16 +0000
Subject: Bug #76038 [NEW]: strtotime returning wrong date on -1 month
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214166@lists.php.net to get a copy of this message
From:             diego at agudo dot eti dot br
Operating system: Windows / Linux
PHP version:      7.2.2
Package:          Date/time related
Bug Type:         Bug
Bug description:strtotime returning wrong date on -1 month

Description:
------------
strtotime returning wrong date on -1 month

Test script:
---------------
$data = '2018-03-31';
print_r($data);
echo "\n\n";
$data = strtotime($data);
print_r($data);
echo "\n\n";
$data = date("Y-m-d", $data);
print_r($data);
echo "\n\n";
$data = strtotime($data);
print_r($data);
echo "\n\n";
$data = date("Y-m-d", strtotime('-1 month', $data));
print_r($data);
echo "\n\n";






Expected result:
----------------
2018-02-28

Actual result:
--------------
2018-03-03

-- 
Edit bug report at https://bugs.php.net/bug.php?id=76038&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=76038&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=76038&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=76038&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=76038&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=76038&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=76038&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=76038&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=76038&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=76038&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=76038&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=76038&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=76038&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=76038&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76038&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=76038&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=76038&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=76038&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76038&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=76038&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=76038&r=mysqlcfg



Thread (5 messages)

« previous php.bugs (#214166) next »