php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28281 strftime prints incorret month, when directed to print only month
Submitted: 2004-05-05 11:57 UTC Modified: 2004-05-05 15:56 UTC
From: info at alt dot lt Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.6 OS: debian woody (latest stable upd)
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: info at alt dot lt
New email:
PHP Version: OS:

 

 [2004-05-05 11:57 UTC] 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 




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-05-05 13:01 UTC] 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 15:56 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

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 14:01:36 2025 UTC