time
Time-related functions and constants.
Members
- hour
- microsecond
- millisecond
- minute
- nanosecond
- second
- from_timestamp
- is_valid_timezone
- now
- parse_duration
- parse_time
- time
hour
time.hourtime.durationA duration representing one hour.
microsecond
time.microsecondtime.durationA duration representing one microsecond.
millisecond
time.millisecondtime.durationA duration representing one millisecond.
minute
time.minutetime.durationA duration representing one minute.
nanosecond
time.nanosecondtime.durationA duration representing one nanosecond.
second
time.secondtime.durationA duration representing one second.
from_timestamp
time.from_timestamp(sec, nsec?)Converts the given Unix time corresponding to the number of seconds and (optionally) nanoseconds since January 1, 1970 UTC into a time object.
secintSeconds since Unix epochnsec?optionalintNanoseconds component (optional)resulttime.timeThe corresponding time valueis_valid_timezone
time.is_valid_timezone(loc)Reports whether loc is a valid time zone name.
locstringTime zone name to validateresultboolTrue if the time zone name is validnow
time.now()Returns the current time. In workflow contexts, returns a deterministic time.
resulttime.timeThe current timeparse_duration
time.parse_duration(d)Parses a duration string (e.g. “1h30m”, “300ms”).
dstringDuration string to parseresulttime.durationThe parsed durationparse_time
time.parse_time(x, format?, location?)Parses the given time string using a specific time format and location. Defaults to RFC3339 format and UTC location.
xstringTime string to parseformat?optionalstringTime format string (default: RFC3339)location?optionalstringTime zone name (default: UTC)resulttime.timeThe parsed time valuetime
time.time(year?, month?, day?, hour?, minute?, second?, nanosecond?, location?)Returns the time corresponding to the given date and time components in the given location. All parameters are optional.
year?optionalintYearmonth?optionalintMonth (1-12)day?optionalintDay of the monthhour?optionalintHour (0-23)minute?optionalintMinute (0-59)second?optionalintSecond (0-59)nanosecond?optionalintNanosecond (0-999999999)location?optionalstringTime zone name (default: UTC)resulttime.timeThe constructed time value