Skip to content
Untitled Sandbox - Developer Documentation
docs/api/time

@usbx/time

Real-world date and time

local time = require("@usbx/time")

time.now

function

The time now, to the millisecond.

time.now() -> number
example
local started = time.now()

Use it forrecording when a player claimed a daily reward, so you can tell when the next one is due.

time.date

function

The parts of a time, or of now.

time.date(time: number?) -> DateParts
example
local today = time.date()

Use it forturning on a weekend event, or showing today's date on a sign.

timeoptionalSeconds since 1970-01-01. Nil means now.

time.iso

function

A time, or now, as text such as 2026-10-18T14:05:09Z.

time.iso(time: number?) -> string
example
print(time.iso())

Use it forprinting a time people can read in your logs or in a match history.

timeoptionalSeconds since 1970-01-01. Nil means now.

time.from_date

function

The time of a date in UTC, as seconds since 1970-01-01. Each part is a whole number, and a day that the month does not have is an error.

time.from_date(date: { … }) -> number
example
local new_year = time.from_date({ year = 2027, month = 1, day = 1 })

Use it forturning a calendar date into a timestamp, for example to start a holiday event.

dateThe date and time in UTC.
Build a from_date callyear · month · day · hour · minute · second
  • yearrequired

    The year, which can be any number from 1 to 9999.

  • monthrequired

    The month as a number from 1 to 12, where 1 is January.

  • dayrequired

    The day of the month, from 1 up to the last day of that month.

  • hourdefault 0

    The hour of the day on a 24 hour clock, from 0 to 23.

  • minutedefault 0

    Which minute of the hour the time is set to.

  • seconddefault 0

    Which second of the minute the time is set to.

↑ ↓ moveEnter openEsc close