#28281 [Opn->Bgs]: strftime prints incorret month, when directed to print only month

From: Date: Wed, 05 May 2004 13:56:15 +0000
Subject: #28281 [Opn->Bgs]: strftime prints incorret month, when directed to print only month
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59249@lists.php.net to get a copy of this message
ID: 28281 Updated by: derick@php.net Reported By: info at alt dot lt -Status: Open +Status: Bogus Bug Type: Unknown/Other Function Operating System: debian woody (latest stable upd) PHP Version: 4.3.6 New Comment: 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 . Previous Comments: ------------------------------------------------------------------------ [2004-05-05 13:01:15] scottmacvicar at ntlworld dot com The last day of any given month can be expressed as the "0" day of the next month, not the -1 day. Hence why 0 is producing the last day of November. This is in the mktime documentation. ------------------------------------------------------------------------ [2004-05-05 11:57:34] info at alt dot lt Description: ------------ strftime prints incorret (decreased by one) month, when directed to print only month. Reproduce code: --------------- <? $month=12; $year=2004; $day=15; $dat=strftime("%B",mktime(0,0,0,$month,0,0)); echo $dat,"<br>"; $dat1=strftime("%Y %B %d ",mktime(0,0,0,$month,$day,$year)); echo $dat1,"<br>"; ?> Expected result: ---------------- Result is self explaining: November 2004 December 15 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28281&edit=1

« previous php.bugs (#59249) next »