php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #75011 Add month on date 31 july 2017
Submitted: 2017-07-31 11:16 UTC Modified: 2017-07-31 11:54 UTC
From: tapask10 at gmail dot com Assigned: derick (profile)
Status: Not a bug Package: Scripting Engine problem
PHP Version: 7.0 OS: Windows 7, Cent OS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tapask10 at gmail dot com
New email:
PHP Version: OS:

 

 [2017-07-31 11:16 UTC] tapask10 at gmail dot com
Description:
------------
i am tring to add some month on date but the return coming error. Please remember that the system date should be 31 july 2017


Test script:
---------------
date('M',strtotime("+2 month"));

Expected result:
----------------
Sep

Actual result:
--------------
Oct

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-31 11:48 UTC] ab@php.net
-Status: Open +Status: Verified -PHP Version: 5.6.31 +PHP Version: 7.0 -Assigned To: +Assigned To: derick
 [2017-07-31 11:54 UTC] derick@php.net
-Status: Verified +Status: Not a bug
 [2017-07-31 11:54 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

+2 months adds two to the month number, making your date 31 September 2017. As that date does not exist, it rolls over to 1 October 2017.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC