generated from pkg/go-template
feat :
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package times
|
||||
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user