Golang Magical Reference Date

Go solves the date parsing by using a magical reference date.

You start with this date

Mon Jan 2 15:04:05 MST 2006

Adjust it into whatever format that you use and use it for parsing dates.
This is neat solution. It would be even better if the go documentation for time.Parse were to mention it.

I found the solution here: https://programming.guide/go/format-parse-string-time-date-example.html

This has now been raised as https://github.com/golang/go/issues/48757

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s