I saw the strangest artifact today while reviewing the pages on my site. The dates of my posts were off. The months and years were correct, but every single post said I wrote it on the sixth day of the month. I couldn’t figure it out, but I knew it had something to do with the date format.
Unlike most computer programming languages, Go has an intuitive date format.
Many computer languages use variations of C’s
In C syntax, the conventional American date format of “January 6, 2006”
is represented by
%B %d, %Y.
Other programming languages have similarly arcane representations.
Go’s date formatting is much easier. In Go, the American date format
is represented with
January 6, 2006. It’s so simple that I couldn’t see
where I went wrong. But if you know Go, you probably saw my error immediately.
It was the date I used.
Go requires a specific date: January 2, 2006. I had mistakenly typed January 6, which caused all my dates to be the sixth of the month.
I doubt many people will make this mistake, but I’m memorializing it for when I do it again.