Skip to main content

Time

Utilities related to time, including for daily rewards.

Functions​

GetUnixTimestampUTC​

Time.GetUnixTimestampUTC(unixTimestamp: number?) → number

Returns the current unix timestamp in UTC, or the inputted timestamp if provided.

GetDateTimeUTC​

Time.GetDateTimeUTC(unixTimestamp: number?) → DateTime

Returns a DateTime converted to universal time.

GetStartOfDayUTC​

Time.GetStartOfDayUTC(unixTimestamp: number?) → number

Returns the unix timestamp for the start of the UTC day.

GetStartOfNextDayUTC​

Time.GetStartOfNextDayUTC(unixTimestamp: number?) → number

Returns the unix timestamp for the start of the next UTC day.

GetSecondsUntilNextDayUTC​

Time.GetSecondsUntilNextDayUTC(unixTimestamp: number?) → number

Returns the amount of seconds until the next UTC day begins.

IsSameDayUTC​

Time.IsSameDayUTC(
firstUnixTimestamp: number,
secondUnixTimestamp: number
) → boolean

Returns true if both timestamps occur on the same UTC day.

GetDayDifferenceUTC​

Time.GetDayDifferenceUTC(
earlierUnixTimestamp: number,
laterUnixTimestamp: number
) → number

Returns the whole UTC day difference between two timestamps.

FormatSecondsToClockString​

Time.FormatSecondsToClockString(totalSeconds: number) → string

Converts a time duration in seconds to a formatted string of xx:xx:xx.

CanClaimDailyReward​

Time.CanClaimDailyReward(
lastClaimTimestampUTC: number?,
currentTimestampUTC: number?
) → boolean

Returns true if a daily reward can be claimed.

WasDailyRewardStreakMissed​

Time.WasDailyRewardStreakMissed(
lastClaimTimestampUTC: number?,
currentTimestampUTC: number?
) → boolean

Returns true if more than one UTC day has passed since the last claim. This is useful for resetting daily reward streaks.

Show raw api
{
    "functions": [
        {
            "name": "GetUnixTimestampUTC",
            "desc": "Returns the current unix timestamp in UTC, or the inputted timestamp if provided.",
            "params": [
                {
                    "name": "unixTimestamp",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 36,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "GetDateTimeUTC",
            "desc": "Returns a `DateTime` converted to universal time.",
            "params": [
                {
                    "name": "unixTimestamp",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "DateTime"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 51,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "GetStartOfDayUTC",
            "desc": "Returns the unix timestamp for the start of the UTC day.",
            "params": [
                {
                    "name": "unixTimestamp",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 62,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "GetStartOfNextDayUTC",
            "desc": "Returns the unix timestamp for the start of the next UTC day.",
            "params": [
                {
                    "name": "unixTimestamp",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 83,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "GetSecondsUntilNextDayUTC",
            "desc": "Returns the amount of seconds until the next UTC day begins.",
            "params": [
                {
                    "name": "unixTimestamp",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 94,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "IsSameDayUTC",
            "desc": "Returns `true` if both timestamps occur on the same UTC day.",
            "params": [
                {
                    "name": "firstUnixTimestamp",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "secondUnixTimestamp",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 107,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "GetDayDifferenceUTC",
            "desc": "Returns the whole UTC day difference between two timestamps.",
            "params": [
                {
                    "name": "earlierUnixTimestamp",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "laterUnixTimestamp",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 119,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "FormatSecondsToClockString",
            "desc": "Converts a time duration in seconds to a formatted string of `xx:xx:xx`.",
            "params": [
                {
                    "name": "totalSeconds",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 133,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "CanClaimDailyReward",
            "desc": "Returns `true` if a daily reward can be claimed.",
            "params": [
                {
                    "name": "lastClaimTimestampUTC",
                    "desc": "",
                    "lua_type": "number?"
                },
                {
                    "name": "currentTimestampUTC",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 150,
                "path": "src/Packages/Time/init.luau"
            }
        },
        {
            "name": "WasDailyRewardStreakMissed",
            "desc": "Returns `true` if more than one UTC day has passed since the last claim.\nThis is useful for resetting daily reward streaks.",
            "params": [
                {
                    "name": "lastClaimTimestampUTC",
                    "desc": "",
                    "lua_type": "number?"
                },
                {
                    "name": "currentTimestampUTC",
                    "desc": "",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 168,
                "path": "src/Packages/Time/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "Time",
    "desc": "Utilities related to time, including for daily rewards.",
    "source": {
        "line": 6,
        "path": "src/Packages/Time/init.luau"
    }
}