Skip to content
imshooter edited this page Nov 26, 2026 · 2 revisions

Writing

TimeFormat writes a time with the specifiers of C++, listed in Specifiers, in the zone of the server or the zone it is given:

new
    text[64]
;

TimeFormat(Now(), "%A, %d %B %Y at %H:%M", text);

Names of days and months are always in English. ISO8601_DATE, ISO8601_TIME, HUMAN_DATE and the other defines hold formats used often, and each specifier has a define too, as WEEKDAY_NAME for %A.

Reading

TimeParse reads a time with the same specifiers:

new
    Timestamp:start
;

if (!TimeParse("2026-12-24 18:00", "%Y-%m-%d %H:%M", start)) {
    print("The date is not valid.");
}

The text is read as a time of the zone, or of the offset it gives with %z. A time of day left out is midnight, and text after the format is left alone. A day the month does not have, as February 30th, is refused.

It reads every specifier TimeFormat writes, and a width before one is the most digits it takes, so %4Y%2m%2d reads 20180602. A weekday read beside a date must be the weekday of that date.

Clone this wiki locally