go - How to set nsec to zero for a time.Time typed value -
there's time.time value created current time, there quick way set "nsec" field zero? part in case not useful map second level date time field in mysql.
use time.truncate time.second:
truncate returns result of rounding t down multiple of d (since 0 time). if d <= 0, truncate returns t unchanged.
playground: http://play.golang.org/p/go-idyu18e.
Comments
Post a Comment