Hi,
Are there functions like:
09:01 +5 --> 09:06
09:01 -08:01--> 01:01
Thanks !
Shuming Wang
*+--------------------------------------------------------------------
*+
*+ Function TimeAsSeconds()
*+
*+--------------------------------------------------------------------
*+
FUNCTION TimeAsSeconds( cTime )
RETURN VAL( cTime ) * 3600 + VAL( SUBSTR( cTime, 4 ) ) * 60 + VAL( SUBSTR( cTime, 7 ) )
*+--------------------------------------------------------------------
*+
*+ Function TimeAsSeconds()
*+
*+--------------------------------------------------------------------
*+
FUNCTION TimeAsMinute( cTime )
LOCAL nSEC := VAL( cTime ) * 3600 + VAL( SUBSTR( cTime, 4 ) ) * 60 //+ VAL( SUBSTR( cTime, 7 ) )
RETURN( nSEC / 60 )
*+--------------------------------------------------------------------
*+
*+ Function TimeAsString()
*+
*+--------------------------------------------------------------------
*+
FUNCTION TimeAsChar( nSeconds )
RETURN STRZERO( INT( MOD( nSeconds / 3600, 24 ) ), 2, 0 ) + ;
STRZERO( INT( MOD( nSeconds / 60, 60 ) ), 2, 0 ) + ;
STRZERO( INT( MOD( nSeconds, 60 ) ), 2, 0 )
*+--------------------------------------------------------------------
*+
*+ Function TimeAsString()
*+
*+--------------------------------------------------------------------
*+
FUNCTION TimeAsString( nSeconds )
RETURN STRZERO( INT( MOD( nSeconds / 3600, 24 ) ), 2, 0 ) + ":" + ;
STRZERO( INT( MOD( nSeconds / 60, 60 ) ), 2, 0 ) + ":" + ;
STRZERO( INT( MOD( nSeconds, 60 ) ), 2, 0 )
*+--------------------------------------------------------------------
*+
*+ Function TimeDiff()
*+
*+--------------------------------------------------------------------
*+
FUNCTION TimeDiff( cStartTime, cEndTime )
Default cEndTime := Time()
RETURN TimeAsString( IF( cEndTime < cStartTime, 86400, 0 ) + ;
TimeAsSeconds( cEndTime ) - TimeAsSeconds( cStartTime ) )
*+--------------------------------------------------------------------
*+
*+ Function TimeIsValid() 20:20:00
*+
*+--------------------------------------------------------------------
*+
FUNCTION TimeIsValid( cTime )
RETURN VAL( cTime ) < 24 .AND. VAL( SUBSTR( cTime, 4 ) ) < 60 .AND. VAL( SUBSTR( cTime, 7 ) ) < 60
ShumingWang wrote:Hi,
Are there functions like:
09:01 +5 --> 09:06
09:01 -08:01--> 01:01
Thanks !
Shuming Wang
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 73 guests