Edit report at https://bugs.php.net/bug.php?id=65788&edit=1
ID: 65788 Updated by: der...@php.net Reported by: condor at stz-bg dot com Summary: mktime return wrong month -Status: Open +Status: Not a bug Type: Bug Package: Date/time related Operating System: Slackware 14.0 x64 PHP Version: 5.4.20 Block user comment: N Private report: N New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. Please do this the right way: $date = date_create("first day of this month 1 year ago"); echo $date->format('Y-m'); Previous Comments: ------------------------------------------------------------------------ [2013-09-30 10:24:06] condor at stz-bg dot com Description: ------------ Hello, Im trying to get with date and mktime one year back from now and I think function return me wrong values. Test script: --------------- echo "Date Y-M\n"; echo date("Y-m"); $r = date("Y-m", mktime(0, 0, 0, 1, date("m") - 12, date("Y"))); echo "\n", $r,"\n"; Expected result: ---------------- 2013-09 2012-09 Actual result: -------------- 2013-09 2012-12 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65788&edit=1