core/time/timezone

timezone

Types

5

Constants

3

Procedures

18

datetime_to_tz

datetime_to_tz :: proc(dt: datetime.DateTime, tz: ^datetime.TZ_Region) -> (out: datetime.DateTime, success: bool)Source

Converts a datetime on one timezone to another timezone

  • dt: The input datetime
  • tz: The timezone to convert to

NOTE: tz will be referenced in the result datetime, so it must stay alive/allocated as long as it is used Returns:

  • out: The converted datetime
  • success: false if the datetime was invalid

dst

dst :: proc(dt: datetime.DateTime) -> (is_dst: bool, success: bool)Source

Checks DST for a given date.

  • dt: The input datetime
  • is_dst: returns true if dt is in daylight savings time, false if not
  • success: returns false if the passed datetime is invalid

dst_unsafe

dst_unsafe :: proc(dt: datetime.DateTime) -> (bool)Source

Checks DST for a given date.

WARNING: This is unsafe because it doesn't check if your datetime is valid or if your region contains a valid record.

  • dt: The input datetime
  • is_dst: returns true if dt is in daylight savings time, false if not

shortname

shortname :: proc(dt: datetime.DateTime) -> (name: string, success: bool)Source

Gets the timezone abbreviation/shortname for a given date. (ex: "PDT")

  • dt: The datetime containing the date, time, and timezone pointer for the lookup

NOTE: The lifetime of name matches the timezone it was pulled from. Returns:

  • name: The timezone abbreviation
  • success: returns false if the passed datetime is invalid

shortname_unsafe

shortname_unsafe :: proc(dt: datetime.DateTime) -> (string)Source

Gets the timezone abbreviation/shortname for a given date. (ex: "PDT")

WARNING: This is unsafe because it doesn't check if your datetime is valid or if your region contains a valid record.

  • dt: The input datetime

NOTE: The lifetime of name matches the timezone it was pulled from. Returns:

  • name: The timezone abbreviation

Reference search

Find anything

Documentation preferences

Settings

System theme variants

Used only while Theme is set to System.