convert to time question

Larry Watts lgwatts at adelphia.net
Wed Oct 15 20:52:28 EDT 2008


I understand that Thierry wanted to convert seconds to show a duration, not a time of day.  For my app, I wrote a rather long piece of code to convert a sum of seconds into a time display (because I'm a real newbie). I appreciate Thierry's concise function, to which I added a line for also showing the seconds in addition to hours and minutes, which is needed in my app.

function MyConvert t

put t div 3600 into h

put ( t - h * 3600 ) div 60 into m

put ( t - h * 3600 ) - ( m * 60 ) into s

return format( "%02d:%02d:%02d", h, m, s)

end MyConvert



Thanks Thierry!

Larry


----- Original Message ----- 
From: "Thierry" <00bioarchimed at free.fr>
To: "How to use Revolution" <use-revolution at lists.runrev.com>
Sent: Wednesday, October 15, 2008 3:03 PM
Subject: Re: convert to time question



Le 15 oct. 08 à 23:28, Jim Ault a écrit :

> Unfortunately I am not the one to help here, since I don't know all  
> the
> variations of the operating systems on which  convert is dependent,  
> daylight
> savings settings, time zones, etc.  Hopefully someone will chime in  
> on this
> for you.  It is not a simple issue.

Yes, I understand.

So, to go ahead, I did make this little convert function,
which transforms any seconds into his hh::mm equivalent.
It's a duration in fact, not a clock time !

function MyConvert t
    put t div 3600 into h
    put ( t - h * 3600 ) div 60 into m
    return format( "%02d:%02d", h, m)
end MyConvert

Out of curiosity, I would be very much interested to understand
how we can make the build in convert command work ?

Any convert expert ?

Regards,
Thierry

_______________________________________________
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the use-livecode mailing list