增加各种方式的获取time实例
This commit is contained in:
parent
685dec4f39
commit
d64bcfbfd8
40
time.go
40
time.go
@ -24,6 +24,46 @@ func OwnTime(inputTime time.Time) *Time {
|
||||
}
|
||||
}
|
||||
|
||||
// OwnTimeFromSecond 从秒获取实例
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 18:47 2023/8/9
|
||||
func OwnTimeFromSecond(second int64) *Time {
|
||||
t := time.UnixMilli(second * 1000)
|
||||
return OwnTime(t)
|
||||
}
|
||||
|
||||
// OwnTimeFromMilli 从ms获取实例
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 18:56 2023/8/9
|
||||
func OwnTimeFromMilli(milli int64) *Time {
|
||||
t := time.UnixMilli(milli)
|
||||
return OwnTime(t)
|
||||
}
|
||||
|
||||
// OwnTimeFromMicro 从微秒获取实例
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 19:00 2023/8/9
|
||||
func OwnTimeFromMicro(micro int64) *Time {
|
||||
t := time.UnixMicro(micro)
|
||||
return OwnTime(t)
|
||||
}
|
||||
|
||||
// OwnTimeFromNano 从纳秒获取实例
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 19:00 2023/8/9
|
||||
func OwnTimeFromNano(nano int64) *Time {
|
||||
t := time.Unix(nano/1e9, nano%1e9)
|
||||
return OwnTime(t)
|
||||
}
|
||||
|
||||
// Time 时间类型
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
|
Loading…
Reference in New Issue
Block a user