Hi Everybody,
Is there a function to convert seconds to a time format like HH:MM:SS ?
Exanple:
nSeconds = 3600
something like SecondsToTime( nSeconds ) would return "01:00:00"
Thanks,
Jeff
Time Function
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact:
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: Time Function
Code: Select all
FUNCTION MAIN()
LOCAL nSec := SECONDS()
? nSec, SECONDSTOTIME( nSec )
INKEY( 0 )
RETURN NIL
STATIC FUNCTION SECONDSTOTIME( nSec )
LOCAL nHour, nMin
nHour = INT( nSec / 3600 )
nSec -= nHour * 3600
nMin = INT( nSec / 60 )
nSec -= nMin * 60
RETURN STRZERO( nHour, 2 ) + ":" + STRZERO( nMin, 2 ) + ":" + STRZERO( nSec, 2 )
- Jeff Barnes
- Posts: 912
- Joined: Sun Oct 09, 2005 1:05 pm
- Location: Ontario, Canada
- Contact: