20220628-13:47:09.053
time.Time
time.Time
13:47:09.053
Format
Parse
date
booktime := book.UpdatedAt.Format("15:04:05.000") //book.UpdatedAt have 20220628-13:47:09.053 time.Time value
fmt.Printf("booktime : %s", booktime)
date, error := time.Parse("15:04:05.000", booktime)
fmt.Printf("date : %s", date)
if error != nil {
fmt.Println(error)
}
输出:
>>> booktime : 13:47:09.053 //But this is a string
>>> date : 0000-01-01 13:47:09.053 +0000 UTC //It should be 13:47:09.053
有什么帮助吗?