How to save time in the database in Go when using GORM and Postgresql?
<p>I'm currently parsing a time string and saving it to the db (Postgresql):</p>

<pre><code>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(&amp;event)
</code></pre>

<p>It's giving me this error: <code>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"</code></p>

<p><code>event.Time﻿⁠⁠⁠⁠</code>'s type is <code>time.Time</code>.</p>

<p>I also tried setting <code>event.Time</code>'s type to string and using time data type in postgresql:</p>

<pre><code>type Event struct {
  Time string `gorm:"type:time
}
</code></pre>

<p>But now I'm getting an error when fetching records in the db:</p>

<pre><code>sql: Scan error on column index 4: unsupported driver -&gt; Scan pair: time.Time -&gt; *string
</code></pre>