GO语言常用时间工具类 timeUtil.go

package util

import "time"


/**
获取时间戳(纳秒)
Testner 20210123
*/
func GetTime_UnixNano() string{
currentTime := time.Now()
// fmt.Println("时间戳(纳秒):", now.UnixNano()/1e6)
return currentTime.Format("2006-01-02 15:04:05.000000")

//fmt.Println("Time with MicroSeconds: ", currentTime.Format("2006-01-02 15:04:05.000000"))

//fmt.Println("Time with NanoSeconds: ", currentTime.Format("2006-01-02 15:04:05.000000000"))

//Time with MicroSeconds: 2020-06-01 10:10:46.155173
//Time with NanoSeconds: 2020-06-01 10:10:46.155173100
}

本着资源共享的原则,欢迎各位朋友在此基础上完善,并进一步分享,让我们的实现更加优雅。如果有任何疑问和需要进一步交流可以留言沟通 Testner创始人(testner.club) Sea
原文地址:https://www.cnblogs.com/sea520/p/14329506.html