Add Date Ordinals (UK Date Format) in Go
Go, despite its robust standard library, does not support ordinal dates out of the box like ‘th’ and ‘st’. This makes producing dates in the format “1st January 2000” much harder - which we use a lot here in the UK. In this post we’ll aim to show how you can make this easier. For reference, these are the options Go uses when chosing a new format: 1 Mon Jan 2 15:04:05 MST 2006 Our example below implements this for ourselves, as we create formatDateWithOrdinal() to print a given time in this format.
How to Format Your Golang Code
Whether you agree with it or not, Go defines a code style at a language level (which I love), and not different styles per project - or having the style as an afterthought! This means there’s very little opinion or conflict when moving between projects so it’s easy. This is very important to Go, as it stresses clarity and consistency as some of the most important factors of code style.
Convert String to Int, Int64, Uint64
This is one of those posts that won’t need a huge introduction. We want to convert a string into an integer. We’ll look at the different ways to do this (based on which sort of int you want). We’ll convert to int, uint and uint64 (though a int64 will be easy enough work out).