Skip to content

TimeFormat

imshooter edited this page Nov 26, 2026 · 1 revision

Write a time as text.

native bool:TimeFormat(Timestamp:timestamp, const format[], output[], size = sizeof (output), const zone[] = "");

Parameters

Parameter Description
Timestamp:timestamp The time.
const format[] The text, with the specifiers in Specifiers.
output[] Array for the text.
size Size of the array.
const zone[] The time zone, as "UTC", or the zone of the server when left out.

Returns

  • true when it was written.
  • false when the format has a specifier it does not know, or there is no such zone.

Remarks

Names of days and months are always in English. A text longer than the array is cut to fit.

Example

stock ShowServerTime(playerid) {
    new
        text[32]
    ;

    TimeFormat(Now(), "%H:%M on %A", text);
    SendClientMessage(playerid, -1, "It is %s.", text);
}

Related

Clone this wiki locally