Use this package to easily convert various time formats to milliseconds. This is a Go port of the Javascript ms library.
Requires Go 1.11 and above. Run this command
go get github.com/zitudu/go-ms
import "github.com/zitudu/go-ms"
age, err := ms.Parse("30days") // 2592000000.000000
expiresIn := ms.MustParse("20 hrs") // 72000000.000000
ms.FormatShort(60000) // 1m
ms.FormatLong(-3 * 60000) // -3 minutes
MIT