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 Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
45 - 1 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu Apr 18 08:02:42 2024 UTC