Skip to main content

Time

Utilities related to time, including for daily rewards.

Functions

GetUnixTimestampUTC

Time.GetUnixTimestampUTC(unixTimestampnumber?) → number

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

GetDateTimeUTC

Time.GetDateTimeUTC(unixTimestampnumber?) → DateTime

Returns a DateTime converted to universal time.

GetStartOfDayUTC

Time.GetStartOfDayUTC(unixTimestampnumber?) → number

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

GetStartOfNextDayUTC

Time.GetStartOfNextDayUTC(unixTimestampnumber?) → number

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

GetSecondsUntilNextDayUTC

Time.GetSecondsUntilNextDayUTC(unixTimestampnumber?) → number

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

IsSameDayUTC

Time.IsSameDayUTC(
firstUnixTimestampnumber,
secondUnixTimestampnumber
) → boolean

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

GetDayDifferenceUTC

Time.GetDayDifferenceUTC(
earlierUnixTimestampnumber,
laterUnixTimestampnumber
) → number

Returns the whole UTC day difference between two timestamps.

FormatSecondsToClockString

Time.FormatSecondsToClockString(totalSecondsnumber) → string

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

CanClaimDailyReward

Time.CanClaimDailyReward(
lastClaimTimestampUTCnumber?,
currentTimestampUTCnumber?
) → boolean

Returns true if a daily reward can be claimed.

WasDailyRewardStreakMissed

Time.WasDailyRewardStreakMissed(
lastClaimTimestampUTCnumber?,
currentTimestampUTCnumber?
) → 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": 26,
                "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": 41,
                "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": 52,
                "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": 73,
                "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": 84,
                "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": 97,
                "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": 109,
                "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": 123,
                "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": 140,
                "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": 158,
                "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"
    }
}