Skip to main content

timeFormatUtil

A utility module for formatting time.

Functions

formatTimeTo24hFormat

timeFormatUtil.formatTimeTo24hFormat(timeStringstring) → string

Formats the given timeString in 12h format to 24h format.

print(timeUtil.formatTimeTo24hFormat("11:56 PM")) --> "23:56"

formatTimeTo12hFormat

timeFormatUtil.formatTimeTo12hFormat(timeStringstring) → string

Formats the given timeString in 24h format to 12h format.

print(timeUtil.formatTimeTo12hFormat("00:41")) --> "12:41" AM
Show raw api
{
    "functions": [
        {
            "name": "formatTimeTo24hFormat",
            "desc": " \nFormats the given `timeString` in `12`h format to `24`h format.\n\n```lua\nprint(timeUtil.formatTimeTo24hFormat(\"11:56 PM\")) --> \"23:56\"\n```",
            "params": [
                {
                    "name": "timeString",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 18,
                "path": "src/timeFormatUtil/init.luau"
            }
        },
        {
            "name": "formatTimeTo12hFormat",
            "desc": " \nFormats the given `timeString` in `24`h format to `12`h format.\n\n```lua\nprint(timeUtil.formatTimeTo12hFormat(\"00:41\")) --> \"12:41\" AM\n```",
            "params": [
                {
                    "name": "timeString",
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string\n"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 39,
                "path": "src/timeFormatUtil/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "timeFormatUtil",
    "desc": "A utility module for formatting time.",
    "source": {
        "line": 6,
        "path": "src/timeFormatUtil/init.luau"
    }
}