php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76161 上一个月时间戳获取错误
Submitted: 2018-03-29 10:09 UTC Modified: 2018-04-04 22:19 UTC
From: 147037524 at qq dot com Assigned:
Status: Duplicate Package: Date/time related
PHP Version: 7.0.28 OS: all
Private report: No CVE-ID: None
 [2018-03-29 10:09 UTC] 147037524 at qq dot com
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-04 22:19 UTC] aharvey@php.net
-Status: Open +Status: Duplicate
 [2018-04-04 22:19 UTC] aharvey@php.net
This is a duplicate of a lot of bugs; let's go with bug #62193 as the best explanation on the first page of Google.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC