You can use the INT to covert both time and can compare it. For ex.: INT(Time1), INT(time2) etc.
This way you won't be changing anything onto DB but just evaluating the data as per your needs.
display integer( "10:30:15" ).
function str2time returns integer ( input st as character ):
define variable t as integer no-undo.
define variable n as integer no-undo.
n = num-entries( st, ":" ).
assign
t = ? when n < 1
t = ( t + integer( entry( 1, st, ":" )) * 3600 ) when n >= 1
t = ( t + integer( entry( 1, st, ":" )) * 60 ) when n >= 2
t = ( t + integer( entry( 1, st, ":" )) * 1 ) when n = 3
.
return t.
end.
display str2time( "10:30:15" ).
function str2time returns integer ( input st as character ):
define variable t as integer no-undo.
define variable n as integer no-undo.
n = num-entries( st, ":" ).
assign
t = ? when n < 1
t = ( t + integer( entry( 1, st, ":" )) * 3600 ) when n >= 1
t = ( t + integer( entry( 2, st, ":" )) * 60 ) when n >= 2
t = ( t + integer( entry( 3, st, ":" )) * 1 ) when n = 3
.
return t.
end.
display string( str2time( "10:30:15" ), "hh:mm:ss" ).
FUNCTION timeToInt RETURNS INTEGER (
i_ctime AS CHAR
):
RETURN
INT(
MTIME( DATETIME( "010101T" + i_ctime ) )
/ 1000
).
END FUNCTION.
MESSAGE STRING( timeToInt( "10:30:15" ), "hh:mm:ss" ) VIEW-AS ALERT-BOX.