Files
.github
.vscode
docker
internal
applicant
deployer
domain
domains
notify
pkg
repository
rest
routes
utils
app
http
rand
resp
variables
xtime
time.go
migrations
ui
.dockerignore
.editorconfig
.gitignore
.goreleaser.yml
CHANGELOG.md
CONTRIBUTING.md
CONTRIBUTING_EN.md
Dockerfile
LICENSE.md
Makefile
README.md
README_EN.md
go.mod
go.sum
main.go
nixpacks.toml
usage.gif
certimate/internal/utils/xtime/time.go
2024-10-15 21:16:43 +08:00

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")
}