Skip to content

DurationFormat

imshooter edited this page Nov 26, 2026 · 1 revision

Write a duration as text.

native bool:DurationFormat(Seconds:duration, output[], size = sizeof (output), const format[] = "");

Parameters

Parameter Description
Seconds:duration The duration. One below zero is written with - before it.
output[] Array for the text.
size Size of the array.
const format[] The text with the specifiers of durations, or words when left out.

Returns

  • true when it was written.
  • false when the format has a specifier it does not know.

Remarks

With no format the duration is written in words, as 1 day, 2 hours, 3 minutes, 4 seconds, leaving out what is zero. A format takes %y, %d, %h, %m and %s, in two digits when in capitals, and each holds what the larger ones in the format leave. See Durations.

Example

stock ShowJailTime(playerid, Seconds:left) {
    new
        text[16]
    ;

    DurationFormat(left, text, .format = "%m:%S");
    GameTextForPlayer(playerid, text, 1000, 3);
}

Related

Clone this wiki locally