Documentation
¶
Overview ¶
Package clock contains time and date-related functions.
Index ¶
- func CurrentTimezone() *time.Location
- func DateFormat(t time.Time) string
- func DateNow() string
- func DateTimeEnd(date string) string
- func DateTimeNow() string
- func DateTimeNowWithExpiry(duration time.Duration) (now, expiry string)
- func DateTimeStart(date string) 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 HourMinFormat(t time.Time) string
- func HourMinNow() string
- func IsExpired(expiry string) bool
- func IsMidnight() bool
- func IsValidDate(date string) bool
- func IsValidDateTime(datetime string) bool
- func MidnightToday() string
- func Now() time.Time
- func Parse(datetime, format string) (time.Time, error)
- func ParseDateTime(datetime string) (time.Time, error)
- func RunForever()
- func SetTimezone(newTimezone string) error
- func Sleep(pause time.Duration, start time.Time)
- func StandardFormat(t time.Time) string
- func TimeFormat(t time.Time) string
- func TimeNow() string
- func TimestampFormat(t time.Time) string
- func TimestampNow() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DateTimeNow ¶
func DateTimeNow() string
Return current datetime in standard format (yyyy-mm-dd hh:mm:ss)
func DateTimeNowWithExpiry ¶
Return datetime now and expiry datetime (based on given duration), Both in standard format (yyyy-mm-dd hh:mm:ss)
func DurationSince ¶
Calculate duration since given datetime, rounded to given duration Return duration as string
func ElapsedSince ¶ added in v0.5.35
Calculate duration since given datetime
func ExtendTime ¶
Extend given datetime with given duration, Return extended time in standard format (yyyy-mm-dd hh:mm:ss)
func ExtractTime ¶ added in v0.5.30
Extracts time from datetime string
func IsValidDateTime ¶
Check if given datetime in standard format is valid
func MidnightToday ¶
func MidnightToday() string
Return midnight datetime today in standard format (yyyy-mm-dd hh:mm:ss)
func ParseDateTime ¶
Parse given string as datetime in standard format, in current timezone
func Sleep ¶
Pauses for given duration, taking into account the starting time, adjusting the pause duration
func StandardFormat ¶
Format given time in standard format (yyyy-mm-dd hh:mm:ss)
func TimestampFormat ¶
Format given time in timestamp format (yymmddhhmmss)
func TimestampNow ¶
func TimestampNow() string
Return current datetime in timestamp format (yymmddhhmmss)
Types ¶
This section is empty.