Documentation
¶
Index ¶
- func DaysBetween(nano1, nano2 int64) int
- func DaysBetweenShared(nano1, nano2 int64) int
- func FormatDate(value any) string
- func FormatDateTime(value any) string
- func FormatDateTimeShort(value any) string
- func FormatTime(value any) string
- func GetTimeZoneOffset() int
- func IsFuture(nano int64) bool
- func IsPast(nano int64) bool
- func IsToday(nano int64) bool
- func Now() int64
- func ParseDate(dateStr string) (int64, error)
- func ParseDateTime(dateStr, timeStr string) (int64, error)
- func ParseTime(timeStr string) (int16, error)
- func SetTimeZoneOffset(hours int)
- type Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DaysBetween ¶ added in v0.3.0
DaysBetween calculates the number of full days between two UnixNano timestamps.
func DaysBetweenShared ¶ added in v0.3.0
DaysBetweenShared is a shared helper function for calculating the number of full days between two timestamps.
func FormatDate ¶ added in v0.3.0
FormatDate formats a value into a date string "YYYY-MM-DD" applying the timezone offset.
func FormatDateTime ¶ added in v0.3.0
FormatDateTime formats a value into a date-time string "YYYY-MM-DD HH:MM:SS" applying the timezone offset.
func FormatDateTimeShort ¶ added in v0.3.0
FormatDateTimeShort formats a value into a short date-time string "YYYY-MM-DD HH:MM".
func FormatTime ¶ added in v0.3.0
FormatTime formats a value into a time string "HH:MM:SS" applying the timezone offset.
func GetTimeZoneOffset ¶ added in v0.3.0
func GetTimeZoneOffset() int
GetTimeZoneOffset returns the current timezone offset in hours.
func IsToday ¶ added in v0.3.0
IsToday checks if the given UnixNano timestamp is today according to the current timezone offset.
func Now ¶ added in v0.3.0
func Now() int64
Now retrieves the current Unix timestamp in nanoseconds in UTC.
func ParseDate ¶ added in v0.3.0
ParseDate parses a date string ("YYYY-MM-DD") into a UnixNano timestamp (UTC).
func ParseDateTime ¶ added in v0.3.0
ParseDateTime combines date and time strings into a single UnixNano timestamp (UTC).
func SetTimeZoneOffset ¶ added in v0.3.0
func SetTimeZoneOffset(hours int)
SetTimeZoneOffset manually sets the timezone offset in hours.