太短小在这里备份
1. time.Time to string
format string : "2006-01-02 15:04:05.999999999 -0700 MST"
t.Format("2006-01-02")
2. time format string to int
time.Parse("2006-01-02", input)
3. yyyy-mm-dd string to yyyymmdd string
strings.Replace(input, "-", "", -1)
本文介绍了时间格式转换的三种实用方法:使用time包将时间转换为字符串,将特定格式的字符串解析为时间类型,以及如何去除日期字符串中的横杠,实现日期格式的灵活转换。
太短小在这里备份
1. time.Time to string
format string : "2006-01-02 15:04:05.999999999 -0700 MST"
t.Format("2006-01-02")
2. time format string to int
time.Parse("2006-01-02", input)
3. yyyy-mm-dd string to yyyymmdd string
strings.Replace(input, "-", "", -1)
转载于:https://www.cnblogs.com/GW977/p/11199439.html
379
1751

被折叠的 条评论
为什么被折叠?
