Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

ISO 8601 defines a number of lesser known features. For example, it allows for not only fractional seconds (12:34:56.78) but also fractional hours (12.3) and minutes (12:34.93). There is a special notation for the midnight of certain day (24:00:00 or 24:00), and obviously another for a positive leap second (08:59:60 etc.). There are three ways to write a date: 2012-05-21, 2012-W21-1 and 2012-142. Intervals can be specified in terms of start and end, start and duration, duration and end, just a duration (i.e. no context). There are also recurring intervals which can be bounded in the number of recurrences or not. And so on and on and on.

That said, ISO 8601 tries to cover most cases for date/time representation. Implementing every bit of ISO 8601 is not desirable of course, but it is certainly worth looking at.



> 2012-142

Does that represent the 142:nd day of the year? Isn't that ambiguous when you can specify a year and month in the same format?


The format is YYYY-DDD with leading zeroes.


So 2012-142 is not a valid date? Should it be 2012-0142?


2012-142 is valid. 2012-012 is valid. 2012-12 is not. For nth day specify exactly three digits. No confusion with months.


To be precise, 2012-12 is valid and refers to a month. There is indeed no ambiguity.


So how would I refer to the 12:th day of the year?


2012-012. Duh.


I don't see the need for a placeholder for the n-thousandth day of the year. Unless we want to accomodate something like 2011-0367 also equating to 2012-0002?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: