A Go's time.Parse
and time.Format
replacement supports joda time format.
Golang developers refuse to support arbitrary format of fractional seconds: #27746, #26002, #6189
So, we can use this package to parse those fractional seconds not in standard format.
package main
import (
"fmt"
"time"
"github.com/tengattack/jodatime"
)
func main() {
date := jodatime.Format(time.Now(), "YYYY.MM.dd")
fmt.Println(date)
dateTime, _ := jodatime.Parse("YYYY-MM-dd HH:mm:ss,SSS", "2018-09-19 19:50:26,208")
fmt.Println(dateTime.String())
}
http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormat.html
MIT