php.net |  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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
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

Patches

Pull Requests

History

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

http://www.php.net/date

where it says:

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


--Jani

 [2001-03-02 11:16 UTC] cnewbill@php.net
Jani,

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.

-Chris

 [2001-03-02 11:16 UTC] cnewbill@php.net
My bad disregard...month...oops.
 [2001-03-04 18:34 UTC] lyric@php.net
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] mrobinso@php.net
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] mrobinso@php.net
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: Sun Dec 22 11:01:30 2024 UTC