ZhangZhihui's Blog  

2023年10月6日

摘要: func main() { str := "4:31am +0800 on Oct 1, 2021" layout := "3:04pm -0700 on Jan 2, 2006" t, err := time.Parse(layout, str) if err != nil { log.Print 阅读全文
posted @ 2023-10-06 13:13 ZhangZhihuiAAA 阅读(12) 评论(0) 推荐(0)
 
摘要: func main() { t := time.Now() fmt.Println(t.Format("3:04PM")) fmt.Println(t.Format("Jan 02, 2006")) } When you run this you should see something like: 阅读全文
posted @ 2023-10-06 12:54 ZhangZhihuiAAA 阅读(16) 评论(0) 推荐(0)
 
摘要: Problem: You want to measure the lapsed time and make sure that it is accurate. Solution: Use the monotonic clock in the Time struct to find the lapse 阅读全文
posted @ 2023-10-06 12:22 ZhangZhihuiAAA 阅读(13) 评论(0) 推荐(0)