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

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

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