I have this function that converts seconds (num) to hours and minutes (num:num).
FUNC string SecondtoTime(num s)
VAR num seconds:=0;
VAR num minutes:=0;
VAR num hours:=0;
s:=Round(s);
IF s>=60 THEN
minutes:= s DIV 60;
seconds:= s MOD 60;
ELSE
seconds:=s;
ENDIF
IF minutes >= 60 THEN
hours:= minutes DIV 60;
minutes:= minutes MOD 60;
ELSE
minutes:=minutes;
ENDIF
RETURN NumToStr(hours,0) + “:” + NumToStr(minutes,0);
ENDFUNC
It works great until you input a time in seconds that is less than 10 minutes into the hour, for example 5:04 or 7:09 would end up being printed as 5:4 and 7:9 respectively. I know this has something to do with the inputs being divisible by 60 so the MOD returns 0 as there is no remainder..how can I force it to add a 0 to complete the time format?