Bug #76161 [NEW]: 上一个月时间戳获取错误

From: Date: Thu, 29 Mar 2018 10:09:10 +0000
Subject: Bug #76161 [NEW]: 上一个月时间戳获取错误
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214520@lists.php.net to get a copy of this message
From:             147037524 at qq dot com
Operating system: all
PHP version:      7.0.28
Package:          Date/time related
Bug Type:         Bug
Bug description:上一个月时间戳获取错误

Description:
------------
3月获取上月时间戳时获取的是28天前时间戳,当月29-31日时,获取的是3月时间戳

Test script:
---------------
/*在2018-03-29执行如下代码*/
/*In the 2018-03-29 execute the following code*/

echo $a = time()-strtotime('-1 month').'<br />';//2419200
echo $a/3600/24;echo '<br />';//28
echo $m = date('m',strtotime('-1 month'));//03


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



Thread (2 messages)

« previous php.bugs (#214520) next »