{"id":1514,"date":"2026-03-27T03:37:09","date_gmt":"2026-03-27T03:37:09","guid":{"rendered":"https:\/\/tiemensfamily.com\/timoncs\/?p=1514"},"modified":"2026-03-27T03:37:09","modified_gmt":"2026-03-27T03:37:09","slug":"go-and-date-time-formatting","status":"publish","type":"post","link":"https:\/\/tiemensfamily.com\/timoncs\/2026\/03\/27\/go-and-date-time-formatting\/","title":{"rendered":"Go and date-time formatting"},"content":{"rendered":"\n<p>Really surprising for a language released in <a href=\"https:\/\/en.wikipedia.org\/wiki\/Go_(programming_language)\">March 2012<\/a> that they would have such a messed-up default formatting (not just parsing).<\/p>\n\n\n\n<p>Ran across this line in <a href=\"https:\/\/gohugo.io\/\">Hugo<\/a> (a static html site builder):<br>       {{ .Date.Format &#8220;2006-01-02&#8221; }}<\/p>\n\n\n\n<p>Then the output you get is:  &#8220;2022-04-09&#8221; (a blog post date, correct).<\/p>\n\n\n\n<p>If you change it to:<br>       {{ .Date.Format &#8220;2000-01-02&#8221; }}<\/p>\n\n\n\n<p>Then the output you get is:  &#8220;9000-04-09&#8221;<\/p>\n\n\n\n<p>As the documentation says: <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/\/ The reference time used in these layouts is the specific time stamp:\n\/\/\n\/\/\t01\/02 03:04:05PM '06 -0700\n\/\/<\/pre>\n\n\n\n<p>i.e. &#8220;01&#8221; is the month, &#8220;02&#8221; is the day, &#8220;03&#8221; is the hour, etc.<\/p>\n\n\n\n<p>Of interest is the extra &#8220;20&#8221; in front of &#8220;06&#8221; &#8211; is it just hard-coding &#8220;20&#8221; in front of what the &#8220;06&#8221; is generating?  It sure could be.  And no, not going to try to read the source to find out.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>This is egregiously bad behavior. It is pretty much a &#8220;Done with Go&#8221; moment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Really surprising for a language released in March 2012 that they would have such a messed-up default formatting (not just parsing). Ran across this line in Hugo (a static html site builder): {{ .Date.Format &#8220;2006-01-02&#8221; }} Then the output you &hellip; <a href=\"https:\/\/tiemensfamily.com\/timoncs\/2026\/03\/27\/go-and-date-time-formatting\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/1514"}],"collection":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/comments?post=1514"}],"version-history":[{"count":2,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/1514\/revisions"}],"predecessor-version":[{"id":1516,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/1514\/revisions\/1516"}],"wp:attachment":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/media?parent=1514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/categories?post=1514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/tags?post=1514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}