1 Star 0 Fork 1

Uni-Minds / bridge-pacs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
datetime.go 643 Bytes
一键复制 编辑 原始数据 按行查看 历史
Liuxy 提交于 2022-10-15 14:29 . Release 0.0.1
package tools
import (
"fmt"
"time"
)
func Dcm4cheDateTimeDecode(dateStr, timeStr string) (t1 time.Time, err error) {
loc, _ := time.LoadLocation("Asia/Shanghai")
t1, err = time.ParseInLocation("20060102-150405", fmt.Sprintf("%s-%s", dateStr, timeStr), loc)
return t1, err
}
func TimeEncodeNow() int64 {
//return time.Now().Format(time.RFC3339)
return time.Now().Unix()
}
func TimeEncode(t time.Time) int64 {
return t.Unix()
}
func TimeEncodeString(ts string) int64 {
t, _ := time.Parse(time.RFC3339, ts)
return t.Unix()
}
func TimeDecode(t int64) time.Time {
return time.Unix(t, 0)
//return time.Parse(time.Unix(t,0), t)
}
Go
1
https://gitee.com/uni-minds/bridge-pacs.git
git@gitee.com:uni-minds/bridge-pacs.git
uni-minds
bridge-pacs
bridge-pacs
v1.0.10

搜索帮助

53164aa7 5694891 3bd8fe86 5694891