FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Time Function
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Time Function
Posted: Sat Apr 07, 2007 01:54 AM

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

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Time Function
Posted: Sat Apr 07, 2007 07:04 AM
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 )


EMG
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Time Function
Posted: Sat Apr 07, 2007 01:46 PM

Exactly what I needed :D

Thanks Enrico.

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)

Continue the discussion