timeConvert
主要是用来对时间的格式进行转换的函数,可以将指定时间戳转换成自定义格式的字符串。本质上是使用 golang 的 time 包提供的 Format 方法
func timeConvert(t1 int, s1 string) string
参数名称 | 参数介绍 |
---|---|
t1 | 需要转换的时间戳 |
s1 | 要转换的格式 |
代表 | 写法 |
---|---|
月份 | 1,01,Jan,January |
日 | 2,02,_2 |
时 | 3,03,15,PM,pm,AM,am |
分 | 4,04 |
秒 | 5,05 |
年 | 06,2006 |
时区 | -07,-0700,Z0700,Z07:00,-07:00,MST |
周几 | Mon,Monday |
待转换数据 | 转换语句 | 输出结果 |
---|---|---|
1560391089 | timeConvert(1560391089, '2006_01_02/3/4/05') | 2019_06_13/9/58/09 |