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

> 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.



From 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


It's still Imho one of the worst decisions Go did, it definitely not easier to read or reason about.


Yeah...

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.




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

Search: