php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22984 Date Function returning incorrect NAME of month
Submitted: 2003-03-31 11:05 UTC Modified: 2003-03-31 15:07 UTC
From: jeremyrimer at yahoo dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.1 OS: win2kadvsrv
Private report: No CVE-ID: None
 [2003-03-31 11:05 UTC] jeremyrimer at yahoo dot com
So I have some code that prints out this and next month's calendar and populates the cells with the day's events. Sometimes, and I can't find root cause except to say that there MUST be a bug in the date() function or the mktime() function because I have a line of code to produce NEXTmonth's month name in text, and it is producing the month TWO months later instead of 1, despite my +1 increment... 

$tyear = date("Y");									// the year - 4 digit
$nyear = date("Y")+1;
$tmonth = date("n");								// the month - no leading 0's
$nmonth = date("n")+1;
$tday = date("j");									// the day as a number

date("F",mktime(0,0,0,$nmonth,$tday,$tyear));

This line can produce not the NEXT month, but TWO months later... Driving me crazy...
-Jeremy

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-31 14:20 UTC] tularis@php.net
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. 

Thank you for your interest in PHP.

I'm pretty sure this is NOT a bug....
 [2003-03-31 15:07 UTC] pollita@php.net
Today (and you did submit this bug today) is 3/31/2003

Your calculation of 'next month' produces 4/31/2003

April only has 30 days....

See your problem? :)

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 09:01:33 2024 UTC