There's a time.Time value created from current time, is there any quick way to set its "nsec" field to zero? As this part in my case is not useful to map to a second level date time field in mysql.
Use time.Truncate
with time.Second
:
Truncate returns the result of rounding t down to a multiple of d (since the zero time). If d <= 0, Truncate returns t unchanged.
Playground: http://play.golang.org/p/go-IdYU18E.