3 ms·
> New diagnostic for incorrect time formats > The vet tool now reports use of the time format 2006-02-01 (yyyy-dd-mm) with Time.Format and time.Parse. This for
by niij 4y ago
> New diagnostic for incorrect time formats
> The vet tool now reports use of the time format 2006-02-01 (yyyy-dd-mm) with Time.Format and time.Parse. This format does not appear in common date standards, but is frequently used by mistake when attempting to use the ISO 8601 date format (yyyy-mm-dd).
It's frequently used by mistake because Go doesn't allow datetime layouts to use the standard YYYY,MM,DD,HH,MM,etc which they ironically used for clarity in their release notes.
I don't understand why Go still forces datetime formats to be specified using "magic numbers" from some time in 2006.
- gepoch 4y agoFrom the docs, the magic reference date: 01/02 03:04:05PM '06 -0700 So that's why it's in 2006, since you asked. https://pkg.go.dev/time#pkg-constants https://pkg.go.dev/time#pkg-constants
- coolgoose 4y agoIt's still Imho one of the worst decisions Go did, it definitely not easier to read or reason about.
- gepoch 4y agoYeah... Just have to remember that the year comes before the time zone but after the seconds :clown: No idea where that came from. Probably the time format from the punchcard machine at bell labs. If it was iso 8601 based, it would almost make sense.