Bug #71255 [Opn->Nab]: Error in strtotime last day of month

From: Date: Thu, 31 Dec 2015 14:10:13 +0000
Subject: Bug #71255 [Opn->Nab]: Error in strtotime last day of month
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-198336@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71255&edit=1 ID: 71255 Updated by: bwoebi@php.net Reported by: ruben at solunapilates dot es Summary: Error in strtotime last day of month -Status: Open +Status: Not a bug Type: Bug Package: Date/time related Operating System: Ubuntu 14.04 PHP Version: 5.5.30 Block user comment: N Private report: N New Comment: That just happens on months with more days than previous month on the last day. December 31 - 1 month = November 31 => December 1 Better try date('F',strtotime('first day of last month')), which will give you what you expect. Previous Comments: ------------------------------------------------------------------------ [2015-12-31 11:56:42] ruben at solunapilates dot es Description: ------------ In day 31 of December, the function date('F',strtotime('- 1 month')); returns "December" instead November. Happens all months Test script: --------------- $today=date('F',strtotime('- 1 month')); print($today); Expected result: ---------------- November Actual result: -------------- December ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71255&edit=1

« previous php.bugs (#198336) next »