|  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-14 14:52 UTC]
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.)

 [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-2022 The PHP Group
All rights reserved.
Last updated: Sat Nov 26 16:05:52 2022 UTC