backend/app/brahma/api/murder/internal/util/time.go

26 lines
391 B
Go
Raw Permalink Normal View History

2022-01-12 14:34:31 +08:00
package util
import "time"
var (
cst *time.Location
)
func init() {
var err error
if cst, err = time.LoadLocation("Asia/Shanghai"); err != nil {
panic(err)
}
// 默认设置为中国时区
time.Local = cst
}
// CSTLayout China Standard Time Layout
const CSTLayout = "2006-01-02 15:04:05"
func CSTLayoutString() string {
ts := time.Now()
return ts.In(cst).Format(CSTLayout)
}