Jump to content

Recommended Posts

Posted

I know there is a StringFormat but ive never understood how it works.

I need to change a number of seconds into Days, hours, mins, seconds

Ive been able to get do it where i can get seconds or mins but not seconds or hours but not min or seconds

but i need it to return the longest time unit and all of the ones under it

$checktime = $time / 60
    If $checktime < 1 Then
        return $time & " Seconds"
    Else
        $time = $time / 60
        $checktime = $time / 60
        If $checktime < 1 Then
            return $time & " Minutes"
Posted

Hi,

ConsoleWrite(_secToHMS(3661) & @CRLF)

Func _secToHMS($i_seconds = 0)
    If $i_seconds < 0 Then Return -1
    Return StringFormat('%.02d:%.02d:%.02d', Mod($i_seconds / 3600, 24), Mod(($i_seconds / 60), 60),Mod($i_seconds, 60))
EndFunc   ;==>_secToHMS

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...