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
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: 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

Add a Patch

Pull Requests

Add a Pull Request

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-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC