|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9519 Incorrect output from date function
Submitted: 2001-03-02 02:44 UTC Modified: 2001-03-04 20:01 UTC
From: djhouy at pmeconsulting dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.0.4pl1 OS: Red Hat Linux 7.0
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: djhouy at pmeconsulting dot com
New email:
PHP Version: OS:


 [2001-03-02 02:44 UTC] djhouy at pmeconsulting dot com
the n option for date gives wrong value

date ("l, F d, Y") outputs Friday, March 02, 2001
date ("l, F n, Y") outputs Friday, March 3, 2001


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-02 09:28 UTC]
It's not wrong, it's exactly what it should be outputting.
Please read the manual page for date:

where it says:

n - month without leading zeros; i.e. "1" to "12"


 [2001-03-02 11:16 UTC]

I believe he is refering to the fact the dates are wrong numerically not typographically.

I get this same result too on PHP 4.0.4pl1 and 4.0.5-dev.


 [2001-03-02 11:16 UTC]
My bad disregard...month...oops.
 [2001-03-04 18:34 UTC]
PHP is performing as documented. You want 'j' not 'n'. See the date manual page :

d - day of the month, 2 digits with leading zeros; i.e. "01" to "31" 
j - day of the month without leading zeros; i.e. "1" to "31" 
n - month without leading zeros; i.e. "1" to "12" 

 [2001-03-04 19:56 UTC]
Changing back to open.
This is a valid bug report.

The snippet provided outputs the following in
php-4.0.4pl1 and php-4.0.4dev:

Sunday, March 04, 2001

Sunday, March 3, 2001

There can't be two Sundays in March, one on the 4th
and the other the 3rd. Not in PHP anyway. Maybe ASP.

 [2001-03-04 20:01 UTC]
On the other hand, if I read these reports more carefully
I would look less like an idiot.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 01:01:31 2024 UTC