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

Popular posts from this blog

android - Pass an Serializable object in AIDL -

How to provide Authorization & Authentication using Asp.net, C#? -

How to use Authorization & Authentication in Asp.net, C#? -