Documentation
¶
Overview ¶
Package clock contains time and date-related functions
Index ¶
- func DateTimeEnd(date Date) string
- func DateTimeStart(date Date) string
- func DurationSince(datetime string, round time.Duration) (string, error)
- func ElapsedSince(datetime string) (time.Duration, error)
- func ExtendTime(datetime string, duration time.Duration) (string, error)
- func ExtractDate(datetime string) string
- func ExtractTime(datetime string) string
- func ExtractYearMonth(datetime string) string
- func HourMinFormat(t time.Time) string
- func HourMinNow() string
- func IsExpired(expiry string) bool
- func IsValidDate(date string) bool
- func IsValidDateTime(datetime string) bool
- func Parse(datetime, format string) (time.Time, error)
- func ParseDateTime(datetime string) (time.Time, error)
- func Sleep(pause time.Duration, start time.Time)
- func TimestampFormat(t time.Time) string
- type Date
- type DateTime
- type Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DateTimeEnd ¶ added in v0.3.26
DateTimeEnd attaches 23:59:59 to given date
func DateTimeStart ¶ added in v0.3.26
DateTimeStart attaches 00:00:00 to given date
func DurationSince ¶ added in v0.3.26
DurationSince returns the duration as string since given datetime, rounded to given duration
func ElapsedSince ¶ added in v0.3.26
ElapsedSince returns the duration since given datetime
func ExtendTime ¶ added in v0.3.26
ExtendTime returns the extended time in standard format
func ExtractDate ¶ added in v0.3.26
ExtractDate returns the date part of the given datetime string
func ExtractTime ¶ added in v0.3.26
ExtractTime extracts time part from given datetime string
func ExtractYearMonth ¶ added in v0.3.26
ExtractYearMonth returns the year and month part of the given datetime string
func HourMinFormat ¶
HourMinFormat formats the given time in hh:mm format
func HourMinNow ¶ added in v0.3.26
func HourMinNow() string
HourMinNow returns the current time in hh:mm format
func IsExpired ¶ added in v0.3.26
IsExpired checks if given datetime is already expired (before current time)
func IsValidDate ¶ added in v0.3.26
IsValidDate checks if given yyyy-mm-dd date is valid
func IsValidDateTime ¶ added in v0.3.26
IsValidDateTime checks if given datetime in standard format is valid
func ParseDateTime ¶ added in v0.3.26
ParseDateTime parses the given string as datetime in standard format
func TimestampFormat ¶
TimestampFormat formats the given time in timestamp format (yymmddhhmmss)
Types ¶
type Date ¶
type Date = string
func DateFormat ¶
DateFormat formats the given time in date format (yyyy-mm-dd)
type DateTime ¶
type DateTime = string
func DateTimeNow ¶
func DateTimeNow() DateTime
DateTimeNow returns the current datetime in standard format
func DateTimeNowWithExpiry ¶ added in v0.3.26
DateTimeNowWithExpiry returns current datetime and expiry datetime in standard format
func StandardFormat ¶
StandardFormat formats the given time in standard format (yyyy-mm-dd hh:mm:ss)
func TimestampNow ¶ added in v0.3.23
func TimestampNow() DateTime
TimestampNow returns the current datetime in timestamp format