# Format Duration

Grammar — Format Duration(duration)
FlagsNative | Function

Formats a duration in seconds into a localization friendly text value. For example, 150 will become 2:30 in English

# Arguments

  • int — Duration

Returns — text

native text FormatDuration(int seconds);

Category: Conversion / Basic Conversions

# Examples

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zhybrid01.sc2map/MapScript.galaxy:2301

    auto52552AD9_val = gv_gasStatus;
    if (auto52552AD9_val == ge_PRESET_IsGasOn_GasOff) {
        TextExpressionSetToken("Param/Expression/17F482EB", "A", FormatDuration(FixedToInt(gv_gasOff_DURATION)));
        lv_label = TextExpressionAssemble("Param/Expression/17F482EB");
        lv_width = FixedToInt(gv_gasOff_DURATION);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zhybrid01.sc2map/MapScript.galaxy:2307

    }
    else if (auto52552AD9_val == ge_PRESET_IsGasOn_GasOn) {
        TextExpressionSetToken("Param/Expression/D78ED081", "A", FormatDuration(FixedToInt(gv_gasOn_DURATION)));
        lv_label = TextExpressionAssemble("Param/Expression/D78ED081");
        lv_width = FixedToInt(FixedToInt(gv_gasOn_DURATION));

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zhybrid01.sc2map/MapScript.galaxy:2345

        autoFE5A62DA_val = gv_gasStatus;
        if (autoFE5A62DA_val == ge_PRESET_IsGasOn_GasOff) {
            TextExpressionSetToken("Param/Expression/FAF7172C", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_mainTimer))));
            libSwaC_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/FAF7172C"));
            libSwaC_gf_SetProgressBarValueRange(0, FixedToInt(gv_gasOff_DURATION));

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zhybrid01.sc2map/MapScript.galaxy:2352

        else if (autoFE5A62DA_val == ge_PRESET_IsGasOn_GasOn) {
            if ((gv_gasOnCycle == 1)) {
                TextExpressionSetToken("Param/Expression/DDBBD16D", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_mainTimer))));
                libSwaC_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/DDBBD16D"));
                libSwaC_gf_SetProgressBarValueRange(0, 180);

campaigns/swarm.sc2campaignbase.sc2maps/maps/campaign/swarm/zhybrid01.sc2map/MapScript.galaxy:2358

            }
            else {
                TextExpressionSetToken("Param/Expression/0EDC1F0B", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_mainTimer))));
                libSwaC_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/0EDC1F0B"));
                libSwaC_gf_SetProgressBarValueRange(0, FixedToInt(gv_gasOn_DURATION));

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zhybrid01.sc2mapMapScript.galaxy:2301

    auto52552AD9_val = gv_gasStatus;
    if (auto52552AD9_val == ge_PRESET_IsGasOn_GasOff) {
        TextExpressionSetToken("Param/Expression/17F482EB", "A", FormatDuration(FixedToInt(gv_gasOff_DURATION)));
        lv_label = TextExpressionAssemble("Param/Expression/17F482EB");
        lv_width = FixedToInt(gv_gasOff_DURATION);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zhybrid01.sc2mapMapScript.galaxy:2307

    }
    else if (auto52552AD9_val == ge_PRESET_IsGasOn_GasOn) {
        TextExpressionSetToken("Param/Expression/D78ED081", "A", FormatDuration(FixedToInt(gv_gasOn_DURATION)));
        lv_label = TextExpressionAssemble("Param/Expression/D78ED081");
        lv_width = FixedToInt(FixedToInt(gv_gasOn_DURATION));

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zhybrid01.sc2mapMapScript.galaxy:2345

        autoFE5A62DA_val = gv_gasStatus;
        if (autoFE5A62DA_val == ge_PRESET_IsGasOn_GasOff) {
            TextExpressionSetToken("Param/Expression/FAF7172C", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_mainTimer))));
            libSwaC_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/FAF7172C"));
            libSwaC_gf_SetProgressBarValueRange(0, FixedToInt(gv_gasOff_DURATION));

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zhybrid01.sc2mapMapScript.galaxy:2352

        else if (autoFE5A62DA_val == ge_PRESET_IsGasOn_GasOn) {
            if ((gv_gasOnCycle == 1)) {
                TextExpressionSetToken("Param/Expression/DDBBD16D", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_mainTimer))));
                libSwaC_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/DDBBD16D"));
                libSwaC_gf_SetProgressBarValueRange(0, 180);

campaigns/swarm.sc2campaign/base.sc2maps/maps/campaign/swarm/zhybrid01.sc2mapMapScript.galaxy:2358

            }
            else {
                TextExpressionSetToken("Param/Expression/0EDC1F0B", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_mainTimer))));
                libSwaC_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/0EDC1F0B"));
                libSwaC_gf_SetProgressBarValueRange(0, FixedToInt(gv_gasOn_DURATION));

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/ptaldarim01.sc2map/MapScript.galaxy:1895

    TriggerEnable(TriggerGetCurrent(), false);
    lv_title = StringExternal("Param/Value/FB406506");
    TextExpressionSetToken("Param/Expression/77903BB8", "A", FormatDuration(FixedToInt(gv_terrazineInactiveDuration)));
    lv_label = TextExpressionAssemble("Param/Expression/77903BB8");
    lv_maxProgress = FixedToInt(gv_terrazineInactiveDuration);

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/ptaldarim01.sc2map/MapScript.galaxy:1924

    while ((libVCMI_gf_GameIsOver() == false)) {
        if ((gv_terrazineActive == true)) {
            TextExpressionSetToken("Param/Expression/09965B88", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_terrazineTimer))));
            libVCUI_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/09965B88"));
            libVCUI_gf_SetProgressBarValueRange(0, FixedToInt(gv_terrazineActiveDuration));

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/ptaldarim01.sc2map/MapScript.galaxy:1931

        else {
            if ((gv_terrazineNightCount == 0)) {
                TextExpressionSetToken("Param/Expression/F313BE02", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_terrazineTimer))));
                libVCUI_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/F313BE02"));
                libVCUI_gf_SetProgressBarValueRange(0, FixedToInt(gv_terrazineInactiveDuration));

campaigns/void.sc2campaignbase.sc2maps/maps/campaign/void/ptaldarim01.sc2map/MapScript.galaxy:1937

            }
            else {
                TextExpressionSetToken("Param/Expression/A57C104A", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_terrazineTimer))));
                libVCUI_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/A57C104A"));
                libVCUI_gf_SetProgressBarValueRange(0, FixedToInt(gv_terrazineInactiveDuration));

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/ptaldarim01.sc2mapMapScript.galaxy:1895

    TriggerEnable(TriggerGetCurrent(), false);
    lv_title = StringExternal("Param/Value/FB406506");
    TextExpressionSetToken("Param/Expression/77903BB8", "A", FormatDuration(FixedToInt(gv_terrazineInactiveDuration)));
    lv_label = TextExpressionAssemble("Param/Expression/77903BB8");
    lv_maxProgress = FixedToInt(gv_terrazineInactiveDuration);

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/ptaldarim01.sc2mapMapScript.galaxy:1924

    while ((libVCMI_gf_GameIsOver() == false)) {
        if ((gv_terrazineActive == true)) {
            TextExpressionSetToken("Param/Expression/09965B88", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_terrazineTimer))));
            libVCUI_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/09965B88"));
            libVCUI_gf_SetProgressBarValueRange(0, FixedToInt(gv_terrazineActiveDuration));

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/ptaldarim01.sc2mapMapScript.galaxy:1931

        else {
            if ((gv_terrazineNightCount == 0)) {
                TextExpressionSetToken("Param/Expression/F313BE02", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_terrazineTimer))));
                libVCUI_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/F313BE02"));
                libVCUI_gf_SetProgressBarValueRange(0, FixedToInt(gv_terrazineInactiveDuration));

campaigns/void.sc2campaign/base.sc2maps/maps/campaign/void/ptaldarim01.sc2mapMapScript.galaxy:1937

            }
            else {
                TextExpressionSetToken("Param/Expression/A57C104A", "A", FormatDuration(FixedToInt(TimerGetRemaining(gv_terrazineTimer))));
                libVCUI_gf_SetProgressBarLabel(TextExpressionAssemble("Param/Expression/A57C104A"));
                libVCUI_gf_SetProgressBarValueRange(0, FixedToInt(gv_terrazineInactiveDuration));

mods/challenges.sc2modbase.sc2data/LibChal.galaxy:1804

    }
    else if (autoA5E8EC1A_val == libChal_ge_ChallengeScoreType_Timeseconds) {
        return FormatDuration(lp_score);
    }
    else {