
Code: Select all
Procedure$ MSToString(MS)
If MS < 1000
ProcedureReturn "Less than a second"
EndIf
Protected Days, Hours, Minutes, Seconds, CurVal
CurVal = MS / 1000
Seconds = Mod(CurVal, 60)
CurVal / 60
Minutes = Mod(CurVal, 60)
CurVal / 60
Hours = Mod(CurVal, 24)
CurVal / 24
Days = CurVal
Protected Res$
If Days > 0
!v_res$ += v_days + " " + (v_days == 1 ? "day" : "days") + ", ";
EndIf
If Hours > 0
!v_res$ += v_hours + " " + (v_hours == 1 ? "hour" : "hours") + ", ";
EndIf
If Minutes > 0
!v_res$ += v_minutes + " " + (v_minutes == 1 ? "minute" : "minutes") + ", ";
EndIf
If Seconds > 0
!v_res$ += v_seconds + " " + (v_seconds == 1 ? "second" : "seconds");
EndIf
ProcedureReturn Res$
EndProcedure