Bug #76175 [Opn->Nab]: date function not working properly for Feb month

From: Date: Mon, 02 Apr 2018 05:59:21 +0000
Subject: Bug #76175 [Opn->Nab]: date function not working properly for Feb month
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214561@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76175&edit=1 ID: 76175 Updated by: requinix@php.net Reported by: ansari dot sohail2013 at gmail dot com Summary: date function not working properly for Feb month -Status: Open +Status: Not a bug Type: Bug Package: Date/time related Operating System: Windows PHP Version: 7.0.29 Block user comment: N Private report: N New Comment: 30-03-2018 - 1 month = 30-02-2018 which overflows to 02-03-2018. 30-03-2018 - 2 months = 30-01-2018 which does not need to overflow. If your application requires special handling around the beginning or end of months then you need to write code for it. Previous Comments: ------------------------------------------------------------------------ [2018-04-02 05:49:55] ansari dot sohail2013 at gmail dot com Description: ------------ $d = '30-03-2018'; echo date('Y-m', strtotime('-1 month '.$d));// should give 2018-02 echo date('Y-m', strtotime('-2 month '.$d));// this gives 2018-01 Output: 2018-03 2018-01 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76175&edit=1

« previous php.bugs (#214561) next »