如何将nsec设置为零。时间类型值

时间:2015-07-08 12:22:40

标签: go

有一段时间。从当前时间创建的时间值,有没有快速的方法将其“nsec”字段设置为零?在我的情况下,这部分对于映射到mysql中的第二级日期时间字段没有用。

1 个答案:

答案 0 :(得分:2)

time.Truncateimport javax.ws.rs.GET; import javax.ws.rs.Produces; import javax.ws.rs.Path; @Path("/SericeCreation") public class SericeCreation { @GET @Produces("text/plain") public String display(){ return "hello"; } }

一起使用
  

Truncate将舍入t的结果返回到d的倍数(从零时间开始)。如果d <= 0,则Truncate返回t不变。

游乐场:http://play.golang.org/p/go-IdYU18E