Skip to content

TimeParse

imshooter edited this page Nov 26, 2026 · 2 revisions

Read a time from text.

native bool:TimeParse(const string[], const format[], &Timestamp:output, const zone[] = "");

Parameters

Parameter Description
const string[] The text.
const format[] How it is written, with the specifiers in Specifiers.
&Timestamp:output The time read.
const zone[] The time zone of the text, or the zone of the server when left out.

Returns

  • true when it was read.
  • false when the text does not match the format, names no whole date, does not fit a Timestamp, or there is no such zone. output is left as it was.

Remarks

It reads every specifier of TimeFormat, and a width before one, as %4Y, is the most digits it takes. An offset in the text, with %z, wins over the zone. A time of day left out is midnight, and text after the format is left alone. A time the clocks skip or repeat is taken as the earliest it can be.

Example

stock bool:ReadEventStart(const text[], &Timestamp:start) {
    return TimeParse(text, "%d/%m/%Y %H:%M", start);
}

Related

Clone this wiki locally