mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-08 21:49:52 +00:00
22 lines
362 B
Go
22 lines
362 B
Go
package xtime
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
func BeijingTimeStr() string {
|
|
location, _ := time.LoadLocation("Asia/Shanghai")
|
|
|
|
// 获取当前时间
|
|
now := time.Now().In(location)
|
|
|
|
// 格式化为字符串
|
|
return now.Format("2006-01-02 15:04:05")
|
|
}
|
|
|
|
func GetTimeAfter(d time.Duration) string {
|
|
t := time.Now().UTC()
|
|
|
|
return t.Add(d).Format("2006-01-02 15:04:05")
|
|
}
|