Skip to main content

Time

Library handles time based parsing / operations. Untested. Based off of PHP's time system.

NOTE

This library is out of date, and does not necessarily work. I recommend using os.time()

Functions

getDaysMonthTable

Time.getDaysMonthTable(yearnumber) → {[number]number}

Returns a Days in months table for the given year

getSecond

Time.getSecond(currentTimenumber) → number

Returns the second of the given time.

getMinute

Time.getMinute(currentTimenumber) → number

Returns the minute of the given time.

getHour

Time.getHour(currentTimenumber) → number

Returns the hour of the given time in 24-hour format.

getDay

Time.getDay(currentTimenumber) → number

Returns the day of the year for the given time.

getYear

Time.getYear(currentTimenumber) → number

Returns the year for the given time.

getYearShort

Time.getYearShort(currentTimenumber) → number

Returns the last two digits of the year for the given time.

getYearShortFormatted

Time.getYearShortFormatted(currentTimenumber) → string

Returns the last two digits of the year formatted as a string.

getMonth

Time.getMonth(currentTimenumber) → number?

Returns the month of the given time.

getFormattedMonth

Time.getFormattedMonth(currentTimenumber) → string

Returns the month formatted as a two-digit string.

getDayOfTheMonth

Time.getDayOfTheMonth(currentTimenumber) → number?

Returns the day of the month for the given time.

getFormattedDayOfTheMonth

Time.getFormattedDayOfTheMonth(currentTimenumber) → string

Returns the day of the month formatted as a two-digit string.

getMonthName

Time.getMonthName(currentTimenumber) → string

Returns the full name of the month for the given time.

getMonthNameShort

Time.getMonthNameShort(currentTimenumber) → string

Returns the abbreviated name of the month for the given time.

getJulianDate

Time.getJulianDate(currentTimenumber) → number

Calculates the Julian date for the given time.

getDayOfTheWeek

Time.getDayOfTheWeek(currentTimenumber) → number

Returns the day of the week as a number (0-6) for the given time.

getDayOfTheWeekName

Time.getDayOfTheWeekName(currentTimenumber) → string

Returns the full name of the day of the week for the given time.

getDayOfTheWeekNameShort

Time.getDayOfTheWeekNameShort(currentTimenumber) → string

Returns the abbreviated name of the day of the week for the given time.

getOrdinalOfNumber

Time.getOrdinalOfNumber(numbernumber) → string

Returns the ordinal suffix (e.g., "st", "nd", "rd", "th") for a given number.

getDayOfTheMonthOrdinal

Time.getDayOfTheMonthOrdinal(currentTimenumber) → string?

Returns the ordinal suffix for the day of the month for the given time.

getFormattedSecond

Time.getFormattedSecond(currentTimenumber) → string

Returns the second formatted as a two-digit string.

getFormattedMinute

Time.getFormattedMinute(currentTimenumber) → string

Returns the minute formatted as a two-digit string.

getRegularHour

Time.getRegularHour(currentTimenumber) → number

Returns the hour in 12-hour format.

getHourFormatted

Time.getHourFormatted(currentTimenumber) → string

Returns the hour formatted as a two-digit string in 24-hour format.

getRegularHourFormatted

Time.getRegularHourFormatted(currentTimenumber) → string

Returns the hour formatted as a two-digit string in 12-hour format.

getamOrpm

Time.getamOrpm(currentTimenumber) → "am" | "pm"

Returns "am" or "pm" based on the given time.

getAMorPM

Time.getAMorPM(currentTimenumber) → "AM" | "PM"

Returns "AM" or "PM" based on the given time.

getMilitaryHour

Time.getMilitaryHour(currentTimenumber) → string

Reports the time in 24-hour format as a two-digit string.

isLeapYear

Time.isLeapYear(currentTimenumber) → boolean

Determines if the year of the given time is a leap year.

getDaysInMonth

Time.getDaysInMonth(currentTimenumber) → number

Returns the number of days in the month for the given time.

getFormattedTime

Time.getFormattedTime(
formatstring,
currentTimenumber
) → string

Formats the given time based on the provided format string.

Show raw api
{
    "functions": [
        {
            "name": "getDaysMonthTable",
            "desc": "Returns a Days in months table for the given year",
            "params": [
                {
                    "name": "year",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [number]: number }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 39,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getSecond",
            "desc": "Returns the second of the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 56,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getMinute",
            "desc": "Returns the minute of the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 65,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getHour",
            "desc": "Returns the hour of the given time in 24-hour format.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 74,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getDay",
            "desc": "Returns the day of the year for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 83,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getYear",
            "desc": "Returns the year for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 92,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getYearShort",
            "desc": "Returns the last two digits of the year for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 101,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getYearShortFormatted",
            "desc": "Returns the last two digits of the year formatted as a string.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 110,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getMonth",
            "desc": "Returns the month of the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 123,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getFormattedMonth",
            "desc": "Returns the month formatted as a two-digit string.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 145,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getDayOfTheMonth",
            "desc": "Returns the day of the month for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 159,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getFormattedDayOfTheMonth",
            "desc": "Returns the day of the month formatted as a two-digit string.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 181,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getMonthName",
            "desc": "Returns the full name of the month for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 196,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getMonthNameShort",
            "desc": "Returns the abbreviated name of the month for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 210,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getJulianDate",
            "desc": "Calculates the Julian date for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 224,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getDayOfTheWeek",
            "desc": "Returns the day of the week as a number (0-6) for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 251,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getDayOfTheWeekName",
            "desc": "Returns the full name of the day of the week for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 260,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getDayOfTheWeekNameShort",
            "desc": "Returns the abbreviated name of the day of the week for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 269,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getOrdinalOfNumber",
            "desc": "Returns the ordinal suffix (e.g., \"st\", \"nd\", \"rd\", \"th\") for a given number.",
            "params": [
                {
                    "name": "number",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 278,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getDayOfTheMonthOrdinal",
            "desc": "Returns the ordinal suffix for the day of the month for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 302,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getFormattedSecond",
            "desc": "Returns the second formatted as a two-digit string.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 316,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getFormattedMinute",
            "desc": "Returns the minute formatted as a two-digit string.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 329,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getRegularHour",
            "desc": "Returns the hour in 12-hour format.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 342,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getHourFormatted",
            "desc": "Returns the hour formatted as a two-digit string in 24-hour format.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 355,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getRegularHourFormatted",
            "desc": "Returns the hour formatted as a two-digit string in 12-hour format.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 368,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getamOrpm",
            "desc": "Returns \"am\" or \"pm\" based on the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "\"am\" | \"pm\""
                }
            ],
            "function_type": "static",
            "source": {
                "line": 381,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getAMorPM",
            "desc": "Returns \"AM\" or \"PM\" based on the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "\"AM\" | \"PM\""
                }
            ],
            "function_type": "static",
            "source": {
                "line": 396,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getMilitaryHour",
            "desc": "Reports the time in 24-hour format as a two-digit string.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 411,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "isLeapYear",
            "desc": "Determines if the year of the given time is a leap year.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 424,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getDaysInMonth",
            "desc": "Returns the number of days in the month for the given time.",
            "params": [
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 438,
                "path": "src/time/src/Shared/Time.lua"
            }
        },
        {
            "name": "getFormattedTime",
            "desc": "Formats the given time based on the provided format string.",
            "params": [
                {
                    "name": "format",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "currentTime",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 505,
                "path": "src/time/src/Shared/Time.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Time",
    "desc": "Library handles time based parsing / operations. Untested. Based off of PHP's time system.\n\n:::note\nThis library is out of date, and does not necessarily work. I recommend using os.time()\n:::",
    "source": {
        "line": 10,
        "path": "src/time/src/Shared/Time.lua"
    }
}