Documentation ¶
Index ¶
- func DateTime(format string, datetime any) template.HTML
- func GetExecutableModTime() time.Time
- func Set(now time.Time)
- func Unset()
- type TimeStamp
- func (ts TimeStamp) Add(seconds int64) TimeStamp
- func (ts TimeStamp) AddDuration(interval time.Duration) TimeStamp
- func (ts TimeStamp) AsLocalTime() time.Time
- func (ts TimeStamp) AsTime() (tm time.Time)
- func (ts TimeStamp) AsTimeInLocation(loc *time.Location) time.Time
- func (ts TimeStamp) AsTimePtr() *time.Time
- func (ts TimeStamp) AsTimePtrInLocation(loc *time.Location) *time.Time
- func (ts TimeStamp) Format(f string) string
- func (ts TimeStamp) FormatDate() string
- func (ts TimeStamp) FormatInLocation(f string, loc *time.Location) string
- func (ts TimeStamp) FormatLong() string
- func (ts TimeStamp) FormatShort() string
- func (ts TimeStamp) IsZero() bool
- func (ts TimeStamp) Year() int
- type TimeStampNano
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetExecutableModTime ¶
GetExecutableModTime get executable file modified time of current process.
Types ¶
type TimeStamp ¶
type TimeStamp int64
TimeStamp defines a timestamp
func (TimeStamp) AddDuration ¶
AddDuration adds time.Duration and return sum
func (TimeStamp) AsLocalTime ¶
AsLocalTime convert timestamp as time.Time in local location
func (TimeStamp) AsTimeInLocation ¶
AsTimeInLocation convert timestamp as time.Time in Local locale
func (TimeStamp) AsTimePtrInLocation ¶
AsTimePtrInLocation convert timestamp as *time.Time in customize location
func (TimeStamp) FormatDate ¶
FormatDate formats a date in YYYY-MM-DD server time zone
func (TimeStamp) FormatInLocation ¶
FormatInLocation formats timestamp as given format with spiecific location
func (TimeStamp) FormatLong ¶
FormatLong formats as RFC1123Z
func (TimeStamp) FormatShort ¶
FormatShort formats as short
type TimeStampNano ¶
type TimeStampNano int64
TimeStampNano is for nano time in database, do not use it unless there is a real requirement.
func TimeStampNanoNow ¶
func TimeStampNanoNow() TimeStampNano
TimeStampNanoNow returns now nano int64
func (TimeStampNano) AsTime ¶
func (tsn TimeStampNano) AsTime() (tm time.Time)
AsTime convert timestamp as time.Time in Local locale
func (TimeStampNano) AsTimeInLocation ¶
func (tsn TimeStampNano) AsTimeInLocation(loc *time.Location) time.Time
AsTimeInLocation convert timestamp as time.Time in Local locale