Not sure if there are already some functions to do this. Anyhow I have implemented them and I appreciate your tests. Not sure if it is fine yet, thanks!
timesecs.prg
timesecs.prg
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
MsgInfo( SecsToTime( TimeToSecs( "15:30:00" ) - TimeToSecs( "12:00:00" ) ) )
return nil
//----------------------------------------------------------------------------//
function TimeToSecs( cTime )
return Val( SubStr( cTime, 1, 2 ) ) * 3600 + ;
Val( SubStr( cTime, 4, 2 ) ) * 60 + ;
Val( SubStr( cTime, 7, 2 ) )
//----------------------------------------------------------------------------//
function SecsToTime( nTimeInSecs )
local nHours := Int( nTimeInSecs / 3600 )
local nMins := Int( nTimeInSecs % 3600 / 60 )
local nSecs := Int( nTimeInSecs - ( nHours * 3600 ) - ( nMins * 60 ) )
return StrZero( nHours, 2 ) + ":" + StrZero( nMins, 2 ) + ":" + ;
StrZero( nSecs, 2 )
//----------------------------------------------------------------------------//