Files
TaskPool/internal/systime/systime.go
T
admin e6956aa001 Initial commit: TaskPool React panel
- React frontend with route-level code splitting
- Backend rebranded from Baihu to TaskPool
- DB brand migration script and local compatibility
2026-07-26 08:43:52 +08:00

32 lines
695 B
Go

package systime
import "time"
// CST 东八区时区
var CST = time.FixedZone("CST", 8*3600)
// Now 返回东八区的当前时间
func Now() time.Time {
return time.Now().In(CST)
}
// InCST 将给定时间转换为东八区时间
func InCST(t time.Time) time.Time {
return t.In(CST)
}
// FormatTime 将时间格式化为标准格式
func FormatTime(t time.Time) string {
return InCST(t).Format("2006-01-02 15:04:05")
}
// FormatDate 将时间格式化为日期格式
func FormatDate(t time.Time) string {
return InCST(t).Format("2006-01-02")
}
// FormatDatetime 用于备份等文件命名格式
func FormatDatetime(t time.Time) string {
return InCST(t).Format("20060102_150405")
}