How to save time in the database in Go when using GORM and Postgresql?
问题 I'm currently parsing a time string and saving it to the db (Postgresql): event.Time, _ := time.Parse("3:04 PM", "9:00 PM") // value of event.Time now is: 0000-01-01 21:00:00 +0000 UTC db.Create(&event) It's giving me this error: pq: R:"DateTimeParseError" S:"ERROR" C:"22008" M:"date/time field value out of range: \"0000-01-01T21:00:00Z\"" F:"datetime.c" L:"3540" event.Time 's type is time.Time . I also tried setting event.Time 's type to string and using time data type in postgresql: