To find way how to compare time, you should remember format for $horolog, which is has two parts separated with comma. First of part it is a date, which is actually numbers of days since 1841 year, so $horolog=1 it is 01/01/1841. Next part is a seconds in a day, no more than 86400, and may have milliseconds after point.
Know it, you can easily convert $horolog to seconds and compare them
SAMPLES>set date1=$zdth("01/02/2016 10:00")
SAMPLES>set date2=$zdth("01/02/2016 20:00")
SAMPLES>zwrite date1,date2
date1="63919,36000"
date2="63919,72000"
SAMPLES>write ($piece(date1,",")*86400+$p(date1,",",2))>($p(date2,",")*86400+$p(date2,",",2))
0
SAMPLES>write ($piece(date1,",")*86400+$p(date1,",",2))<($p(date2,",")*86400+$p(date2,",",2))
1You can also use SQL function DATEDIFF, to see difference in seconds between to dates
SAMPLES>write $system.SQL.DATEDIFF("ss",date1,date2)
36000
SAMPLES>write $system.SQL.DATEDIFF("ss",date2,date1)
-36000
SAMPLES>write $system.SQL.DATEDIFF("ss",date1,date1)
0
- Log in to post comments