I'm having to parse times that are in the format:
20060102150405000
E.g. "20170116111621978" represents 16 January 2017, 11:16:21.978. It looks to me like the Go time package requires an embedded period in the date format (05.000) (and hence the input). I can't think of any way short of rewriting the source string to include a period to parse these with time.Parse. Anyone have a suggestion?
Unfortunately the time package requires a period prefix for the fraction seconds part (milliseconds) in the layout, so you have 2 choices:
20060102150405.00020060102150405, parse the milliseconds (e.g. using strconv.Atoi()) and add it to the time using Time.Add().If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With