时间可以快速获取当前小时

This commit is contained in:
刘祥超
2024-03-12 16:20:38 +08:00
parent 6d8be979db
commit bf08170f6d
2 changed files with 11 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ type FastTime struct {
unixTimeMilliString string
ymd string
round5Hi string
hour int
}
func NewFastTime() *FastTime {
@@ -48,6 +49,7 @@ func NewFastTime() *FastTime {
unixTimeMilliString: types.String(rawTime.UnixMilli()),
ymd: timeutil.Format("Ymd", rawTime),
round5Hi: timeutil.FormatTime("Hi", rawTime.Unix()/300*300),
hour: rawTime.Hour(),
}
}
@@ -91,3 +93,7 @@ func (this *FastTime) Round5Hi() string {
func (this *FastTime) Format(layout string) string {
return timeutil.Format(layout, this.rawTime)
}
func (this *FastTime) Hour() int {
return this.hour
}