golang time

网址

time文档

代码记录

time格式化成字符串

const DATETIME_FORMAT              = "2006-01-02T15:04:05.000"
curTime := time.Now().UTC()  // utc时间
logData["timestamp"] = string(curTime.Format(DATETIME_FORMAT))

时间差

sTime := time.Now()
...
eTime := time.Now()
reqCost := float64(eTime.Sub(sTime).Nanoseconds()) / 1e6 // 毫秒上报
支付宝打赏 微信打赏

来杯咖啡~

文章导航