News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Derick Rethans:
ISO 8601 week dates
September 24, 2013 @ 09:54:31

Derick Rethans has a new post with details about handling ISO 8601 dates in PHP via the DateTime functionality. It's a response to some bugs filed having to do with week numbering.

Week numbers are defined in this same ISO 8601 standard. Each year has 52 or 53 weeks and weeks always start on a Monday. Week number 1 of each year is the first week in a year that has the first Thursday of the year, or in other words, the week containing January 4th.

He talks about some of the date format arguments that use would use when working with the ISO 8601 formatting and how it relates to the calendar year. He points out that the "Y" format specifier is not the same as the "o" - the first being the calendar year while the second relates to the ISO 8601 year.

As conclusion, this article shows that there are two ways representing dates in PHP. In the Gregorian1 calendar with year, month and day (of month), and in the ISO 8601 calendar with year, week and day (of week). The format characters for the two different years are either Y or o and they should not be confused.
0 comments voice your opinion now!
iso8601 date datetime format specifier gregorian calendar difference

Link: http://derickrethans.nl/iso-8601-weeks.html

blog comments powered by Disqus

Similar Posts

Zend Developer Zone: Why Should I Care What Server My Application is Running On?

Alan Sorkin's Blog: The Difference Between A Developer, A Programmer And A Computer Scientist

XPertDeveloper.com: Is Your PHP Application Affected by the Y2K38?

Ben Ramsey: Dates Are Hard

Kore Nordmann's Blog: Published article "Image creation with PHP"


Community Events





Don't see your event here?
Let us know!


library list community voicesoftheelephpant interview artisanfiles podcast opinion security series framework version tool introduction symfony laravel composer language release conference

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework