6 ms·
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 t
by tumdum_ 11y ago
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.
- chmike 11y agoThanks 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.
- redroom 11y ago> 1. The date is not easy to remember not easy to remember or just unfamiliar? > 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 ? is that not `3`? > I guess I should than use my own formatting instead of predefined formating. what do you mean? some common formats are defined here and how it all works is described there as well https://golang.org/pkg/time/#pkg-constants https://golang.org/pkg/time/#pkg-constants it also mentions https://golang.org/pkg/time/#Time.Format https://golang.org/pkg/time/#Time.Format (click the `> Example`)
- wallyhs 11y agoYou 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.
- nulltype 11y ago1. http://strftime.org/ 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.