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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: 147037524 at qq dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sat Dec 21 13:01:31 2024 UTC