time
A library for working with time and date.
All timestamps are Unix timestamps (time since 1970-01-01T00:00:00Z in the given unit) and are always in UTC; the local timezone is only applied when a timestamp is turned into a calendar date or a string, or parsed back from one (time.parse, time.format, time.toISOString, ...).
By default the local timezone follows the host, including its daylight saving rules. Assigning a different value to time.zone switches to a fixed UTC offset without DST.
Classes & types
Fields
| Name | Type | Description |
|---|
zone | number | The standard (non-DST) UTC offset of the local timezone in hours, may be fractional (e.g. 5.5). Assign a different value to use a fixed UTC offset instead of the host's timezone. |
dst | boolean | Whether the host's timezone is currently in daylight saving time. |
zone_dst | number | The UTC offset of the host's timezone during daylight saving time in hours, equal to zone if the host has no DST. |
Functions
time.add | Adds a duration to a timestamp. |
time.civilFromDays | Converts a day count relative to the Unix epoch (1970-01-01), as produced by time.daysFromCivil, back into a civil (Gre… |
time.civilFromTimestamp | Converts a Unix timestamp in seconds into a civil (Gregorian) date and time of day. |
time.dayOfYear | Returns the ordinal day of the year for a given civil (Gregorian) date, where January 1st is 1. |
time.daysFromCivil | Converts a civil (Gregorian) calendar date into a day count relative to the Unix epoch (1970-01-01), i.e. the same scal… |
time.daysInMonth | Returns the number of days in a given month of a given year, accounting for leap years. |
time.daysInYear | Returns the number of days in a given year, accounting for leap years. |
time.elapsed | Returns the time elapsed since lua/game was started. |
time.format | Converts a timestamp to a formatted string. |
time.fromDuration | Converts a duration string to the specified unit. |
time.fromISOString | Parses a JS-like ( ISO 8601 ) date-time string, as produced by JavaScript's Date.prototype.toISOString() / JSON.stringi… |
time.fromRFC2822 | Parses an RFC 2822 date-time string ( as used in email Date: headers, for example Mon, 15 Jan 2024 10:30:00 +0000 ) and… |
time.isLeapYear | Checks if a year is a leap year, following the Gregorian rule: divisible by 4, except century years (divisible by 100),… |
time.isoWeek | Returns the ISO 8601 week-numbering year and week number for a given civil (Gregorian) date. |
time.isoWeeksInYear | Returns the number of ISO 8601 weeks in a given ISO week-numbering year. |
time.lastMonthWeekday | Returns the last occurrence of a given weekday in a given month of a given year, e.g. "the last Sunday of March 2026". |
time.monthWeekday | Returns the index-th occurrence of a given weekday in a given month of a given year, e.g. "the second Sunday of March 2… |
time.nextWeekday | Returns the next weekday after the given one, wrapping from 6 (Saturday) back to 0 (Sunday). |
time.now | Returns the current Unix timestamp (UTC) in the specified unit. |
time.offset | Returns the UTC offset of the local timezone at the given moment, in seconds. |
time.parse | Returns a table with the date and time components. |
time.prevWeekday | Returns the weekday before the given one, wrapping from 0 (Sunday) back to 6 (Saturday). |
time.sub | Subtracts a duration from a timestamp. |
time.tick | Returns the time elapsed since the last call to this function (or since the library was loaded). |
time.timestampFromCivil | Converts a civil (Gregorian) date and time of day into a Unix timestamp in seconds. |
time.toDuration | Converts a number of seconds to a duration string. |
time.toISOString | Converts a timestamp to a JS-like ( ISO 8601 ) date-time string, for example 2024-01-15T10:30:00.000Z or 2024-01-15T10:… |
time.toRFC2822 | Converts a timestamp to an RFC 2822 date-time string, for example Mon, 15 Jan 2024 10:30:00 +0000. |
time.transform | Transforms a timestamp to a different unit. |
time.weekdayDifference | Returns the number of days to add to weekday y to reach weekday x, both given as 0-based weekday indices in [0, 6] (the… |
time.weekdayFromCivil | Returns the day of the week for a given civil (Gregorian) date. |
time.weekdayFromDays | Returns the day of the week for a given day count relative to the Unix epoch, as produced by time.daysFromCivil. |
function time.add(timestamp?: number, unit?: time.Unit, duration_str: time.DurationString, as_float?: boolean): number
Adds a duration to a timestamp.
The duration string can have the following units: ns, us, ms, s, m, h, d, w, y.
mo and y are calendar months and years in local time: the wall-clock time is kept and the day is clamped to the target month (Jan 31 + 1mo is Feb 28/29). All other units are exact amounts of time.
| Suffix | Name | Value |
|---|
ns | Nanosecond | 1 / 1,000,000,000 seconds |
us | Microsecond | 1 / 1,000,000 seconds |
ms | Millisecond | 1 / 1,000 seconds |
s | Second | 1 second |
m | Minute | 60 seconds |
h | Hour | 60 minutes |
d | Day | 24 hours |
w | Week | 7 days |
mo | Month | 1 calendar month |
y | Year | 1 calendar year |
Parameters
| Name | Type | Description |
|---|
timestampoptional | number | The timestamp to add the duration to, current time by default. |
unitoptional | time.Unit | The unit of the timestamp, 's' by default. |
duration_str | time.DurationString | The duration string to add. |
as_floatoptional | boolean | Whether to return the timestamp as a float, false by default. |
Returns
| Type | Name | Description |
|---|
number | new_timestamp | |
function time.civilFromDays(days?: integer): integer, integer, integer
Converts a day count relative to the Unix epoch (1970-01-01), as produced by time.daysFromCivil, back into a civil (Gregorian) calendar year, month, and day. The inverse of time.daysFromCivil.
Based on Howard Hinnant's "civil_from_days" algorithm, the counterpart to daysFromCivil's "days_from_civil".
Parameters
| Name | Type | Description |
|---|
daysoptional | integer | The number of days since the Unix epoch. If omitted, the current local date is returned. |
Returns
| Type | Name | Description |
|---|
integer | year | The calendar year. |
integer | month | The calendar month (1-12). |
integer | day | The calendar day of the month. |
function time.civilFromTimestamp(timestamp?: number): integer, integer, integer, integer, integer, number, integer
Parameters
| Name | Type | Description |
|---|
timestampoptional | number | The Unix timestamp in seconds, current time by default. |
Returns
| Type | Name | Description |
|---|
integer | year | The calendar year. |
integer | month | The calendar month (1-12). |
integer | day | The calendar day of the month. |
integer | hour | The hour (0-23). |
integer | minute | The minute (0-59). |
number | second | The second (0-59), fractional if timestamp was. |
integer | weekday | The 0-based weekday index (0 = Sunday, 6 = Saturday). |
function time.dayOfYear(year?: integer, month?: integer, day?: integer): integer
Returns the ordinal day of the year for a given civil (Gregorian) date, where January 1st is 1.
Parameters
| Name | Type | Description |
|---|
yearoptional | integer | The calendar year, the current year by default. |
monthoptional | integer | The calendar month (1-12), the current month by default. |
dayoptional | integer | The calendar day of the month, the current day by default. |
Returns
| Type | Name | Description |
|---|
integer | day_of_year | The day of the year (1-366). |
function time.daysFromCivil(year?: integer, month?: integer, day?: integer): integer
Converts a civil (Gregorian) calendar date into a day count relative to the Unix epoch (1970-01-01), i.e. the same scale as days in time.civilFromDays and time.weekdayFromDays — negative for dates before the epoch, 0 for the epoch date itself, positive after.
Based on Howard Hinnant's "days_from_civil" algorithm, which is valid for any year representable by the host's integer type, correctly accounting for the Gregorian leap year rule (including the century/400-year exceptions) without needing a lookup table.
See howardhinnant date algorithms and socantre lua port.
Parameters
| Name | Type | Description |
|---|
yearoptional | integer | The calendar year. Defaults to the current local year. |
monthoptional | integer | The calendar month (1-12). Defaults to the current local month. |
dayoptional | integer | The calendar day of the month. Defaults to the current local day. |
Returns
| Type | Name | Description |
|---|
integer | days | The number of days since the Unix epoch (1970-01-01). |
function time.daysInMonth(month?: integer, year?: integer): integer
Returns the number of days in a given month of a given year, accounting for leap years.
The result is always in the range [28, 31].
month is wrapped into the valid [1, 12] range via modulo before use, so out-of-range values (e.g. 13 or 0) are normalized rather than erroring.
Parameters
| Name | Type | Description |
|---|
monthoptional | integer | The month to get the number of days in (1–12), the current month by default. |
yearoptional | integer | The year to get the number of days in, the current year by default. |
Returns
| Type | Name | Description |
|---|
integer | days_in_month | The number of days in the month. |
function time.daysInYear(year?: integer): integer
Returns the number of days in a given year, accounting for leap years.
Parameters
| Name | Type | Description |
|---|
yearoptional | integer | The year to get the number of days in, the current year by default. |
Returns
| Type | Name | Description |
|---|
integer | days_in_year | The number of days in the year, 365 or 366. |
function time.elapsed(unit?: time.Unit, as_float?: boolean): number
Returns the time elapsed since lua/game was started.
Parameters
| Name | Type | Description |
|---|
unitoptional | time.Unit | The unit to return the elapsed time in, 's' by default. |
as_floatoptional | boolean | Whether to return the elapsed time as a float, true by default. |
Returns
| Type | Name | Description |
|---|
number | timestamp | The elapsed time in the specified unit. |
function time.fromDuration(duration_str: time.DurationString, unit?: time.Unit, as_float?: boolean): integer
Converts a duration string to the specified unit.
The duration string can have the following units: ns, us, ms, s, m, h, d, w, y. Numbers without a unit are seconds.
| Suffix | Name | Value |
|---|
ns | Nanosecond | 1 / 1,000,000,000 seconds |
us | Microsecond | 1 / 1,000,000 seconds |
ms | Millisecond | 1 / 1,000 seconds |
s | Second | 1 second |
m | Minute | 60 seconds |
h | Hour | 60 minutes |
d | Day | 24 hours |
w | Week | 7 days |
mo | Month | ~30 days |
y | Year | 365 days |
Parameters
| Name | Type | Description |
|---|
duration_str | time.DurationString | The duration string to convert. |
unitoptional | time.Unit | The unit to convert the duration to, 's' by default. |
as_floatoptional | boolean | Whether to return the duration as a float, false by default. |
Returns
| Type | Name | Description |
|---|
integer | timestamp | The duration in the specified unit. |
function time.fromISOString(str: string, unit?: time.Unit, as_float?: boolean): number
Parses a JS-like ( ISO 8601 ) date-time string, as produced by JavaScript's Date.prototype.toISOString() / JSON.stringify( new Date() ), and converts it to a unix timestamp.
Supported formats ( matching JavaScript's Date Time String Format ):
2024-01-15T10:30:00.000Z - UTC, with milliseconds2024-01-15T10:30:00Z - UTC, without milliseconds2024-01-15T10:30:00.000+02:00 / 2024-01-15T10:30:00+0200 - explicit offset2024-01-15T10:30Z - without seconds2024-01-15T10:30:00 - no timezone info, interpreted as local time ( DST-aware )2024-01-15 - date only, interpreted as UTC midnight, matching JavaScript's behaviour
A space can be used instead of T. Fractions of any length are supported, digits beyond the precision of unit are truncated.
Parameters
| Name | Type | Description |
|---|
str | string | The JS-like date-time string to parse. |
unitoptional | time.Unit | The unit to return the timestamp in, s by default. |
as_floatoptional | boolean | Whether to return the timestamp as a float, false by default. |
Returns
| Type | Name | Description |
|---|
number | timestamp | The unix timestamp in the specified unit. |
function time.fromRFC2822(str: string, unit?: time.Unit, as_float?: boolean): number
Parses an RFC 2822 date-time string ( as used in email Date: headers, for example Mon, 15 Jan 2024 10:30:00 +0000 ) and converts it to a unix timestamp.
The weekday name, the seconds and the timezone are all optional. The timezone can be a numeric offset ( +0200, -0500 ), or one of the named zones UT, GMT, UTC, EST, EDT, CST, CDT, MST, MDT, PST, PDT. A missing or unrecognised timezone is treated as UTC, per RFC 2822's handling of the obsolete military zones.
Parameters
| Name | Type | Description |
|---|
str | string | The RFC 2822 date-time string to parse. |
unitoptional | time.Unit | The unit to return the timestamp in, s by default. |
as_floatoptional | boolean | Whether to return the timestamp as a float, false by default. |
Returns
| Type | Name | Description |
|---|
number | timestamp | The unix timestamp in the specified unit. |
function time.isLeapYear(year?: integer): boolean
Checks if a year is a leap year, following the Gregorian rule: divisible by 4, except century years (divisible by 100), unless also divisible by 400.
Parameters
| Name | Type | Description |
|---|
yearoptional | integer | The year to check, the current local year by default. |
Returns
| Type | Name | Description |
|---|
boolean | is_leap_year | Returns true if the year is a leap year, otherwise false. |
function time.isoWeek(year?: integer, month?: integer, day?: integer): integer, integer, integer
Returns the ISO 8601 week-numbering year and week number for a given civil (Gregorian) date.
ISO weeks start on Monday, and week 1 is the week containing the year's first Thursday (equivalently, the week containing January 4th). Because of that, the first few days of January may belong to the last week of the previous ISO year, and the last few days of December may belong to week 1 of the next one — which is why the ISO year is returned alongside the week.
See ISO week date.
Parameters
| Name | Type | Description |
|---|
yearoptional | integer | The calendar year, the current year by default. |
monthoptional | integer | The calendar month (1-12), the current month by default. |
dayoptional | integer | The calendar day of the month, the current day by default. |
Returns
| Type | Name | Description |
|---|
integer | iso_year | The ISO week-numbering year, which may differ from year by one near year boundaries. |
integer | week | The ISO week number (1-53). |
integer | iso_weekday | The ISO weekday (1 = Monday, 7 = Sunday). |
function time.isoWeeksInYear(year?: integer): integer
Returns the number of ISO 8601 weeks in a given ISO week-numbering year.
A year has 53 ISO weeks if it starts on a Thursday, or if it is a leap year that starts on a Wednesday; otherwise it has 52.
Parameters
| Name | Type | Description |
|---|
yearoptional | integer | The ISO week-numbering year, the current year by default. |
Returns
| Type | Name | Description |
|---|
integer | weeks | The number of ISO weeks in the year, 52 or 53. |
function time.lastMonthWeekday(weekday: integer, month?: integer, year?: integer): integer, integer
Returns the last occurrence of a given weekday in a given month of a given year, e.g. "the last Sunday of March 2026".
Based on Howard Hinnant's year_month_weekday_last: takes the last day of the month, then steps back by the forward distance from weekday to that day's weekday.
month is wrapped into the valid [1, 12] range via modulo before use, the same way time.daysInMonth does.
See howardhinnant date.
Parameters
| Name | Type | Description |
|---|
weekday | integer | The 0-based weekday index (0 = Sunday, 6 = Saturday) to look for. |
monthoptional | integer | The month to search in (1–12), the current month by default. |
yearoptional | integer | The year to search in, the current year by default. |
Returns
| Type | Name | Description |
|---|
integer | day | The day of the month (22-31) of the last occurrence of weekday. |
integer | days | The same date as a day count relative to the Unix epoch, as produced by time.daysFromCivil. |
function time.monthWeekday(weekday: integer, index: integer, month?: integer, year?: integer): integer | nil, integer | nil
Returns the index-th occurrence of a given weekday in a given month of a given year, e.g. "the second Sunday of March 2026".
Based on Howard Hinnant's year_month_weekday: takes the first day of the month, steps forward by the distance from that day's weekday to weekday, then adds whole weeks.
month is wrapped into the valid [1, 12] range via modulo before use, the same way time.daysInMonth does.
Negative index values count from the end of the month instead: -1 is the last occurrence (same as time.lastMonthWeekday), -2 the second-to-last, and so on.
If the month has no such occurrence (e.g. a 5th Monday in a month that only has four), or index is 0, nil is returned.
See howardhinnant date.
Parameters
| Name | Type | Description |
|---|
weekday | integer | The 0-based weekday index (0 = Sunday, 6 = Saturday) to look for. |
index | integer | The 1-based occurrence of weekday within the month (1-5), or a negative index counting from the end of the month (-1--5). |
monthoptional | integer | The month to search in (1–12), the current month by default. |
yearoptional | integer | The year to search in, the current year by default. |
Returns
| Type | Name | Description |
|---|
integer | nil | day | The day of the month (1-31) of the index-th occurrence of weekday, or nil if the month has no such occurrence. |
integer | nil | days | The same date as a day count relative to the Unix epoch, as produced by time.daysFromCivil, or nil if the month has no such occurrence. |
function time.nextWeekday(weekday: integer): integer
Returns the next weekday after the given one, wrapping from 6 (Saturday) back to 0 (Sunday).
Parameters
| Name | Type | Description |
|---|
weekday | integer | The current weekday index (0-6). |
Returns
| Type | Name | Description |
|---|
integer | next_weekday | The following weekday index (0-6). |
function time.now(unit?: time.Unit, as_float?: boolean): integer | number
Returns the current Unix timestamp (UTC) in the specified unit.
Parameters
| Name | Type | Description |
|---|
unitoptional | time.Unit | The unit to return the current time in, s by default. |
as_floatoptional | boolean | Whether to return the timestamp as a float, false by default. |
Returns
| Type | Name | Description |
|---|
integer | number | timestamp | The current timestamp in the specified unit. |
function time.offset(timestamp?: number): integer
Returns the UTC offset of the local timezone at the given moment, in seconds.
Follows the host's timezone including its DST rules, or time.zone as a fixed offset if it was changed.
Parameters
| Name | Type | Description |
|---|
timestampoptional | number | The Unix timestamp in seconds, current time by default. |
Returns
| Type | Name | Description |
|---|
integer | offset | The UTC offset in seconds, e.g. 7200 for +02:00. |
function time.parse(timestamp?: number, unit?: time.Unit, in_utc?: boolean): time.DateInfo
Returns a table with the date and time components.
Parameters
| Name | Type | Description |
|---|
timestampoptional | number | The timestamp to parse, current time by default. |
unitoptional | time.Unit | The unit to parse the timestamp from, 's' by default. |
in_utcoptional | boolean | Whether to return the date in UTC instead of local time, false by default. |
Returns
| Type | Name | Description |
|---|
time.DateInfo | date_info | The date and time components. |
function time.prevWeekday(weekday: integer): integer
Returns the weekday before the given one, wrapping from 0 (Sunday) back to 6 (Saturday).
Parameters
| Name | Type | Description |
|---|
weekday | integer | The current weekday index (0-6). |
Returns
| Type | Name | Description |
|---|
integer | previous_weekday | The preceding weekday index (0-6). |
function time.sub(timestamp?: number, unit?: time.Unit, duration_str: time.DurationString, as_float?: boolean): number
Subtracts a duration from a timestamp.
The duration string can have the following units: ns, us, ms, s, m, h, d, w, y.
mo and y are calendar months and years in local time: the wall-clock time is kept and the day is clamped to the target month (Mar 31 - 1mo is Feb 28/29). All other units are exact amounts of time.
| Suffix | Name | Value |
|---|
ns | Nanosecond | 1 / 1,000,000,000 seconds |
us | Microsecond | 1 / 1,000,000 seconds |
ms | Millisecond | 1 / 1,000 seconds |
s | Second | 1 second |
m | Minute | 60 seconds |
h | Hour | 60 minutes |
d | Day | 24 hours |
w | Week | 7 days |
mo | Month | 1 calendar month |
y | Year | 1 calendar year |
Parameters
| Name | Type | Description |
|---|
timestampoptional | number | The timestamp to subtract the duration from, current time by default. |
unitoptional | time.Unit | The unit of the timestamp, 's' by default. |
duration_str | time.DurationString | The duration string to subtract. |
as_floatoptional | boolean | Whether to return the timestamp as a float, false by default. |
Returns
| Type | Name | Description |
|---|
number | new_timestamp | |
function time.tick(unit?: time.Unit, as_float?: boolean): number
Returns the time elapsed since the last call to this function (or since the library was loaded).
Parameters
| Name | Type | Description |
|---|
unitoptional | time.Unit | The unit to return the elapsed time in, 's' by default. |
as_floatoptional | boolean | Whether to return the elapsed time as a float, true by default. |
Returns
| Type | Name | Description |
|---|
number | delta | The elapsed time in the specified unit. |
function time.timestampFromCivil(year?: integer, month?: integer, day?: integer, hour?: integer, minute?: integer, second?: number): number
Converts a civil (Gregorian) date and time of day into a Unix timestamp in seconds.
Unlike os.time, this is pure arithmetic: the result is not affected by the host's local timezone or DST settings, and works for any year, including those before 1970. The date and time are treated as UTC; subtract time.offset() to convert from local time.
Parameters
| Name | Type | Description |
|---|
yearoptional | integer | The calendar year, the current year by default. |
monthoptional | integer | The calendar month (1-12), the current month by default. |
dayoptional | integer | The calendar day of the month, the current day by default. |
houroptional | integer | The hour (0-23), 0 by default. |
minuteoptional | integer | The minute (0-59), 0 by default. |
secondoptional | number | The second (0-59), 0 by default; may be fractional. |
Returns
| Type | Name | Description |
|---|
number | timestamp | The Unix timestamp in seconds. |
function time.toDuration(timestamp: integer, unit?: time.Unit): string
Converts a number of seconds to a duration string.
The duration string can have the following units: ns, us, ms, s, m, h, d, w, y. Negative durations have every segment negated (-1m -30s), so they parse back with time.fromDuration.
| Suffix | Name | Value |
|---|
ns | Nanosecond | 1 / 1,000,000,000 seconds |
us | Microsecond | 1 / 1,000,000 seconds |
ms | Millisecond | 1 / 1,000 seconds |
s | Second | 1 second |
m | Minute | 60 seconds |
h | Hour | 60 minutes |
d | Day | 24 hours |
w | Week | 7 days |
mo | Month | ~30 days |
y | Year | 365 days |
Parameters
| Name | Type | Description |
|---|
timestamp | integer | The timestamp to convert. |
unitoptional | time.Unit | The unit to convert the timestamp to, 's' by default. |
Returns
| Type | Name | Description |
|---|
string | duration_str | The duration string. |
function time.toISOString(timestamp?: integer, unit?: time.Unit, in_utc?: boolean): string
Converts a timestamp to a JS-like ( ISO 8601 ) date-time string, for example 2024-01-15T10:30:00.000Z or 2024-01-15T10:30:00.000-05:00 with timezone offset.
Milliseconds are included if unit is ms, us or ns, or if timestamp has a fraction.
The output is compatible with JavaScript's Date.prototype.toISOString() / JSON.stringify( new Date() ), and can be parsed back with time.fromISOString.
Parameters
| Name | Type | Description |
|---|
timestampoptional | integer | The timestamp to convert, current time by default. |
unitoptional | time.Unit | The unit of timestamp, s by default. |
in_utcoptional | boolean | Whether to format the string in UTC ( with a Z suffix ), false by default. |
Returns
| Type | Name | Description |
|---|
string | str | The JS-like date-time string. |
function time.toRFC2822(timestamp?: integer, unit?: time.Unit, in_utc?: boolean): string
Converts a timestamp to an RFC 2822 date-time string, for example Mon, 15 Jan 2024 10:30:00 +0000.
This is the format used by email headers ( Date: ) and HTTP's obsolete rfc1123-date, and is also what JavaScript's Date.prototype.toString() timezone-less variants are based on.
Parameters
| Name | Type | Description |
|---|
timestampoptional | integer | The timestamp to convert, current time by default. |
unitoptional | time.Unit | The unit of timestamp, s by default. |
in_utcoptional | boolean | Whether to format the string in UTC, false by default. |
Returns
| Type | Name | Description |
|---|
string | str | The RFC 2822 date-time string. |
function time.weekdayDifference(x: integer, y: integer): integer
Returns the number of days to add to weekday y to reach weekday x, both given as 0-based weekday indices in [0, 6] (the same convention as time.weekdayFromDays).
The result is always in [0, 6]: 0 if x and y are the same weekday, otherwise the forward (wrapping) distance from y to x.
Parameters
| Name | Type | Description |
|---|
x | integer | The target weekday index (0-6). |
y | integer | The starting weekday index (0-6). |
Returns
| Type | Name | Description |
|---|
integer | difference | The number of days forward from y to reach x, in [0, 6]. |
function time.weekdayFromCivil(year?: integer, month?: integer, day?: integer): integer
Parameters
| Name | Type | Description |
|---|
yearoptional | integer | The calendar year, the current year by default. |
monthoptional | integer | The calendar month (1-12), the current month by default. |
dayoptional | integer | The calendar day of the month, the current day by default. |
Returns
| Type | Name | Description |
|---|
integer | weekday | The 0-based weekday index (0 = Sunday, 6 = Saturday) for that date. |
function time.weekdayFromDays(days: integer): integer
Parameters
| Name | Type | Description |
|---|
days | integer | The number of days since the Unix epoch. |
Returns
| Type | Name | Description |
|---|
integer | weekday | The 0-based weekday index (0 = Sunday, 6 = Saturday) for that day. |