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.
1条回答 默认 最新
douhuang2673 2015-07-08 12:26关注Use
time.Truncatewithtime.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.
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报