Hacker News new | past | comments | ask | show | jobs | submit login

There is no ambiguity - you are to provide predefined date in your layout. That predefined date (Mon Jan 2 15:04:05 -0700 MST 2006) is chosen in a way so that there is no ambiguity.



Thanks for the clarification. That info was missing in the date API presentation. Indeed, there is no ambiguity.

Just two comments: 1. The date is not easy to remember 2. There is still an ambiguity with hours representation. What if I want to represent hours without a leading 0 for values smaller than 10 ? I guess I should than use my own formatting instead of predefined formating.


You can remember it as 1 2 3 4 5 6 7: First month, second day, 3pm and four minutes and five seconds in the year '06, offset -7.


1. http://strftime.org/ is not easy to remember

2. You could format it with a placeholder for the hours, then replace the placeholder with the hours you want. Oddly this is only a problem for 24 hour time, 12 hour time lets you drop the leading zero.




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

Search: