The method of timestamp formatting in the go language

  • 2020-05-26 09:20:01
  • OfStack

This article illustrates the method of timestamp formatting in the go language. Share with you for your reference. The specific implementation method is as follows:

var t int64 = time.Now().Unix()
var s string = time.Unix(t, 0).Format("2006-01-02 15:04:05")
println(s)

This way is special, according to 123456 to remember it: January 02 at 3:04:05 in 2006

I hope this article has been helpful to your programming of Go language.


Related articles: