I have the following timestamps, that i want to parse:
2022.05.14-00.37.13:544
I tried it with the following code snippet, but i could not parse the milliseconds:
package main
import (
"fmt"
"time"
)
func main() {
s := "2022.05.14-00.37.13:544"
t, err := time.Parse("2006.01.02-15.04.05:000", s)
fmt.Println(t)
fmt.Println(err)
}
It fails with:
parsing time "2022.05.14-00.37.13:544" as "2006.01.02-15.04.05:000": cannot parse "544" as ":000"
I tried different things, but none of them worked.
It only works if i remove the milliseconds.
What is the proper “reference string” to get this working also with the milliseconds?
Thanks for all hints.
Here is the Go Playground with the above code snippet: