Docs · time

time

28 time commands, generated from the engine's own registry — signatures, parameters and a worked example each. A does something command acts on the game; a needs x() one answers a confident wrong answer when its client hooks are missing.

clockString returns string
clockString() -> string

The time of day as text, HH:MM in 24-hour form, for a readout.

Example
uiLabel("clock", clockString())
dateString returns string
dateString() -> string

The date alone as "2026-08-19" — the day half of timestamp(), for keying a daily tally.

Example
print(dateString())
dayName returns string
dayName() -> string

The name of today's day of the week, like "Monday".

Example
uiLabel("day", dayName())
dayOfMonth returns int
dayOfMonth() -> int

The day of the month right now, 1 to 31.

Example
print("day", dayOfMonth())
dayOfWeek returns int
dayOfWeek() -> int

The day of the week right now, 1 for Monday through 7 for Sunday.

Example
if dayOfWeek() == 6 { print("saturday") }
dayOfYear returns int
dayOfYear() -> int

Which day of the year today is, 1 to 366.

Example
print(dayOfYear())
daysBetween returns int
daysBetween(year1: int, month1: int, day1: int, year2: int, month2: int, day2: int) -> int

How many days lie from the first date to the second — negative when the second is earlier. Refuses a date the calendar does not have.

ParameterTypeWhat it does
year1required int the first date's year
month1required int the first date's month, 1 to 12
day1required int the first date's day of the month
year2required int the second date's year
month2required int the second date's month, 1 to 12
day2required int the second date's day of the month
Example
print(daysBetween(2026, 1, 1, 2026, 8, 19))
daysInMonth returns int
daysInMonth(year: int, month: int) -> int

How many days a month has in a given year — February answers 28 or 29 by the year. Refuses a month outside 1 to 12.

ParameterTypeWhat it does
yearrequired int the year the month is in
monthrequired int the month, 1 for January to 12 for December
Example
print(daysInMonth(2026, 2))
elapsedSince returns int
elapsedSince(millis: int) -> int

How many milliseconds have passed since an earlier nowMillis. Save a start and pass it here to time something.

ParameterTypeWhat it does
millisrequired int an earlier nowMillis reading
Example
if elapsedSince(0) > 0 { print("time has passed") }
epochDays returns int
epochDays() -> int

Today as a count of days since 1970 — one number a day, for date arithmetic and daily keys that sort.

Example
print(epochDays())
formatDuration returns string
formatDuration(millis: int) -> string

A length of time written for a person, like "1h 5m 3s". Zero reads as "0s".

ParameterTypeWhat it does
millisrequired int a length of time in milliseconds
Example
uiLabel("ran", formatDuration(elapsedSince(0)))
hourNow returns int
hourNow() -> int

The hour of the day right now, 0 to 23, on the machine's clock. For 'only run in the evenings' without the schedule grid.

Example
if hourNow() >= 23 { stop }
isLeapYear returns bool
isLeapYear(year: int) -> bool

True when a year has the 29th of February in it.

ParameterTypeWhat it does
yearrequired int the year to ask about
Example
if isLeapYear(2028) { print("leap") }
isWeekday returns bool
isWeekday() -> bool

True when today is Monday to Friday, on the machine's clock.

Example
if isWeekday() { print("weekday") }
isWeekend returns bool
isWeekend() -> bool

True when today is Saturday or Sunday, on the machine's clock.

Example
if isWeekend() { print("weekend") }
millisOfTicks returns int
millisOfTicks(ticks: int) -> int

How many milliseconds a number of game ticks is — the other half of ticksOf. Faults on overflow.

ParameterTypeWhat it does
ticksrequired int a number of game ticks
Example
print(millisOfTicks(5))
minuteNow returns int
minuteNow() -> int

The minute of the hour right now, 0 to 59.

Example
print("minute", minuteNow())
minutesSinceMidnight returns int
minutesSinceMidnight() -> int

How many minutes of today have passed, 0 to 1439 — the number the schedule grid thinks in.

Example
print(minutesSinceMidnight())
monthName returns string
monthName() -> string

The name of the current month, like "January".

Example
uiLabel("month", monthName())
monthNow returns int
monthNow() -> int

The month right now, 1 for January through 12 for December.

Example
print("month", monthNow())
nowMillis returns int
nowMillis() -> int

The number of milliseconds since 1970 — the wall clock as one number. Save it and compare it later to time how long something took.

Example
let started = nowMillis()  print(started)
secondNow returns int
secondNow() -> int

The second of the minute right now, 0 to 59.

Example
print("second", secondNow())
secondsUntilHour returns int
secondsUntilHour(hour: int) -> int

How many seconds until the clock next reads an hour — today if it is still ahead, tomorrow otherwise. Refuses an hour outside 0 to 23.

ParameterTypeWhat it does
hourrequired int the hour to wait for, 0 to 23
Example
print(secondsUntilHour(21))
ticksOf returns int
ticksOf(millis: int) -> int

How many game ticks a length of time is — one tick is 600 milliseconds, rounded down.

ParameterTypeWhat it does
millisrequired int a length of time in milliseconds
Example
print(ticksOf(3000))
timeOfDay returns string
timeOfDay() -> string

A word for the part of the day right now: night, morning, afternoon or evening.

Example
if timeOfDay() == "night" { stop }
timestamp returns string
timestamp() -> string

The date and time as one sortable line: "2026-08-19 14:03:59" — for a print or a saved setting a person reads later.

Example
print(timestamp())
weekOfYear returns int
weekOfYear() -> int

Which week of the year this is, 1 to 53, weeks starting Monday.

Example
print(weekOfYear())
yearNow returns int
yearNow() -> int

The year right now, as a four-digit number.

Example
print("year", yearNow())