time

Provides time and date operations.

fun time::mdays(Year: integer, Month: integer): integer

TBD

type time

An instant in time with nanosecond resolution.

meth time(Year: integer, Month: integer, Day: integer): time

Returns the time specified by the provided components in the local time.

meth time(Year: integer, Month: integer, Day: integer, Hour: integer, Minute: integer, Second: integer, TimeZone: nil): time

Returns the time specified by the provided components in UTC.

meth time(Year: integer, Month: integer, Day: integer, Hour: integer, Minute: integer, Second: integer, TimeZone: time::zone): time

Returns the time specified by the provided components in the specified time zone.

meth time(Year: integer, Month: integer, Day: integer, TimeZone: nil): time

Returns the time specified by the provided components in UTC.

meth time(String: string): time

Parses the String as a time according to ISO 8601.

time("2023-02-09T21:19:33.196413266")
:> 2023-02-09T20:19:33.196413
meth time(String: string, Format: string): time

Parses the String as a time according to specified format. The time is assumed to be in local time.

meth time(String: string, Format: string, TimeZone: time::zone): time

Parses the String as a time according to specified format in the specified time zone.

meth time(String: string, TimeZone: time::zone): time

Parses the String as a time in the specified time zone.

time("2023-02-09T21:19:33.196413266", time::zone::"America/Chicago")
:> 2023-02-10T03:19:33.196413
meth time(): time

Returns the current time.

time() :> 2024-05-02T07:41:06.573427
meth time(Year: integer, Month: integer, Day: integer, Hour: integer, Minute: integer, Second: integer): time

Returns the time specified by the provided components in the local time.

meth time(Year: integer, Month: integer, Day: integer, TimeZone: time::zone): time

Returns the time specified by the provided components in the specified time zone.

meth time(String: string, Format: string, TimeZone: nil): time

Parses the String as a time according to specified format. The time is assumed to be in UTC.

meth (Start: time) + (Duration: number): time

Returns the time Duration seconds after Start.

time("2022-04-01 12:00:00") + 3600 :> 2022-04-01T13:00:00
meth (Start: time) - (Duration: number): time

Returns the time Duration seconds before Start.

time("2022-04-01 12:00:00") - 3600 :> 2022-04-01T11:00:00
meth (End: time) - (Start: time): real

Returns the time elasped betwen Start and End in seconds.

time("2022-04-01 12:00:00") - time("2022-04-01 11:00:00")
:> 3600
meth (A: time) <> (B: time): integer

Compares the times A and B and returns -1, 0 or 1 respectively.

meth (Time: time):day: integer

Returns the date from Time in local time.

meth (Time: time):day(TimeZone: nil): integer

Returns the date from Time in UTC.

meth (Time: time):day(TimeZone: time::zone): integer

Returns the date from Time in TimeZone.

meth (Time: time):hour: integer

Returns the hour from Time in local time.

meth (Time: time):hour(TimeZone: nil): integer

Returns the hour from Time in UTC.

meth (Time: time):hour(TimeZone: time::zone): integer

Returns the hour from Time in TimeZone.

meth (Time: time):minute: integer

Returns the minute from Time in local time.

meth (Time: time):minute(TimeZone: nil): integer

Returns the minute from Time in UTC.

meth (Time: time):minute(TimeZone: time::zone): integer

Returns the minute from Time in TimeZone.

meth (Time: time):month: integer

Returns the month from Time in local time.

meth (Time: time):month(TimeZone: nil): integer

Returns the month from Time in UTC.

meth (Time: time):month(TimeZone: time::zone): integer

Returns the month from Time in TimeZone.

meth (Time: time):nsec: integer

Returns the nanoseconds component of Time.

meth (Arg₁: time):precision(Arg₂: integer)

TBD

meth (Time: time):second: integer

Returns the second from Time in local time.

meth (Time: time):second(TimeZone: nil): integer

Returns the second from Time in UTC.

meth (Time: time):second(TimeZone: time::zone): integer

Returns the second from Time in TimeZone.

meth (Time: time):wday: integer

Returns the day of the week from Time in local time.

meth (Time: time):wday(TimeZone: nil): integer

Returns the day of the week from Time in UTC.

meth (Time: time):wday(TimeZone: time::zone): integer

Returns the day of the week from Time in TimeZone.

meth (Time: time):with(Component₁ is Value₁, ...): time

Returns Time with the the specified components updated.

meth (Time: time):with(TimeZone: nil, Component₁ is Value₁, ...): time

Returns Time with the the specified components updated in UTC.

meth (Time: time):with(TimeZone: time::zone, Component₁ is Value₁, ...): time

Returns Time with the the specified components updated in the specified time zone.

meth (Time: time):yday: integer

Returns the number of days from the start of the year from Time in local time.

meth (Time: time):yday(TimeZone: nil): integer

Returns the number of days from the start of the year from Time in UTC.

meth (Time: time):yday(TimeZone: time::zone): integer

Returns the number of days from the start of the year from Time in TimeZone.

meth (Time: time):year: integer

Returns the year from Time in local time.

meth (Time: time):year(TimeZone: nil): integer

Returns the year from Time in UTC.

meth (Time: time):year(TimeZone: time::zone): integer

Returns the year from Time in TimeZone.

meth (Buffer: string::buffer):append(Time: time): string

Formats Time as a local time.

meth (Buffer: string::buffer):append(Time: time, TimeZone: nil): string

Formats Time as a UTC time according to ISO 8601.

meth (Buffer: string::buffer):append(Time: time, Format: string): string

Formats Time as a local time according to the specified format.

meth (Buffer: string::buffer):append(Time: time, Format: string, TimeZone: nil): string

Formats Time as a UTC time according to the specified format.

meth (Buffer: string::buffer):append(Time: time, Format: string, TimeZone: time::zone): string

Formats Time as a time in TimeZone according to the specified format.

meth (Buffer: string::buffer):append(Time: time, TimeZone: time::zone): string

Formats Time as a time in TimeZone.

type time::day < enum::cyclic
  • ::Monday

  • ::Tuesday

  • ::Wednesday

  • ::Thursday

  • ::Friday

  • ::Saturday

  • ::Sunday

type time::month < enum::cyclic
  • ::January

  • ::February

  • ::March

  • ::April

  • ::May

  • ::June

  • ::July

  • ::August

  • ::September

  • ::October

  • ::November

  • ::December

type time::zone

A time zone.

meth (Buffer: string::buffer):append(TimeZone: time::zone)

Appends the name of TimeZone to Buffer.

meth (Name: time::zone::type) :: (Arg₂: string): time::zone | error

Returns the time zone identified by Name or an error if no time zone is found.