Jump to content

Recommended Posts

Hi All,

I have a hard time figuring out what really is that ISO-8601 year format and what its purpose is. Third party applications that we use (Drupal, Solr...) would tell you to configure the date format using an ISO-8601 year like 'd-m-o' instead of 'd-m-Y'.

Then all the sudden we are the 30rd of December 2013 and all my websites would display dates as 30-12-2014 . I guess this makes kind of sense reading the php manual:

"if the ISO week number (W) belongs to the previous or next year, that year is used instead".

But I'm neither sure why the iso week number belongs to 2014 or how this format could be usefull since dates are just formatted wrong.

 

Anyone to help me understand this mess ?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/284971-date-format-iso-8601-year-number/
Share on other sites

If you are working with week numbers it makes sense to have the correct year to which the week number belongs. Consider

Date             ISO Wk
d M Y            o-W
25 Dec 2010     2010-51
26 Dec 2010     2010-51

27 Dec 2010     2010-52
28 Dec 2010     2010-52
29 Dec 2010     2010-52
30 Dec 2010     2010-52
31 Dec 2010     2010-52
01 Jan 2011     2010-52
02 Jan 2011     2010-52

03 Jan 2011     2011-01
04 Jan 2011     2011-01
05 Jan 2011     2011-01
06 Jan 2011     2011-01

For the date 01-Jan-2011 it would be wrong to have 2011-52 as the week

Edited by Barand
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.