php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #22711 Return ISO 8601 year
Submitted: 2003-03-14 14:21 UTC Modified: 2003-03-17 11:54 UTC
From: unix-guy at pacbell dot net Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4CVS-2003-03-14 (stable) OS: All
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: unix-guy at pacbell dot net
New email:
PHP Version: OS:

 

 [2003-03-14 14:21 UTC] unix-guy at pacbell dot net
The date() function should provide a way to return the ISO 8601 year. As of yesterday's snap (STABLE-20030313), the  call:

date("Y W", 1041321600) 

returns "2002 1", which could be argued is correct as it returns the year and the ISO 8601 week, however in the context it is wrong and should probably return "2003 1".

I think there should be a formatting option to return ISO 8601 year as well as week to clear up any confusion.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-14 14:52 UTC] derick@php.net
Use the strftime function, which already supports this:

%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. (Use %G or %g for the year component that corresponds to the week number for the specified timestamp.)


Derick
 [2003-03-14 16:35 UTC] unix-guy at pacbell dot net
That's perfect - I didn't look at strftime(), sorry for the waste of your time.
 [2003-03-17 11:54 UTC] unix-guy at pacbell dot net
Unfortunately for me, the %g and %G formats are not supported under HP-UX...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 05:01:30 2024 UTC