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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 14:01:32 2024 UTC