jbenezech Posted December 30, 2013 Share Posted December 30, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/284971-date-format-iso-8601-year-number/ Share on other sites More sharing options...
Barand Posted December 30, 2013 Share Posted December 30, 2013 (edited) 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 December 30, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/284971-date-format-iso-8601-year-number/#findComment-1463282 Share on other sites More sharing options...
jbenezech Posted December 31, 2013 Author Share Posted December 31, 2013 Thanks for the clarification. So that o format would only be used when working in conjunction with W . It does not make any sense to have a format d-m-o Quote Link to comment https://forums.phpfreaks.com/topic/284971-date-format-iso-8601-year-number/#findComment-1463389 Share on other sites More sharing options...
dalecosp Posted December 31, 2013 Share Posted December 31, 2013 It does not make any sense to have a format d-m-o I concur. Sounds like someone who's impressed with his own knowledge coded that, or else they're doing hyperactive future-proofing. d-m-Y seems good enough for me Quote Link to comment https://forums.phpfreaks.com/topic/284971-date-format-iso-8601-year-number/#findComment-1463426 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.