How to Tell the Time in PICO-8
19, November 2022
PICO-8 provides a way to get information from the system (computer) it’s running on: STAT()
. To get the current date and time in PICO-8, simply call STAT()
with the numbers 80
, 81
, 82
, 83
, 84
, and 85
.
YEAR=STAT(80)
MONTH=STAT(81)
DAY=STAT(82)
HOUR=STAT(83)
MINUTE=STAT(84)
SECOND=STAT(85)
Here’s a quick way to see that it works:
FUNCTION _UPDATE()
YEAR=STAT(80)
MONTH=STAT(81)
DAY=STAT(82)
HOUR=STAT(83)
MINUTE=STAT(84)
SECOND=STAT(85)
END
FUNCTION _DRAW()
D=YEAR..'-'..MONTH..'-'..DAY
T=HOUR..':'..MINUTE..':'..SECOND
PRINT(D..' '..T)
END