Working with datetime variables
Posted in 1999
Topics: General Discussion
> Hi all, > > Here is a small program where I want to compare two datetime and > know which one is greater. > > > > > main() > > { > > $datetime year to fraction(3) upd_time; > > $datetime year to fraction(3) tmp_time; > > $interval day to fraction(3) inv_time; > > > > $database crd; > > $select upd_dtm into $tmp_time from gblupd_dtm; > > > > if (dtsub ( &upd_time, &tmp_time, &inv_time ) == 0 ) > > if ( inv_time.in_dec.dec_pos == 0 ) > > printf("NEGATIVE"); > > else > > printf("POSITIVE"); > > > > } > > In this program I am using the "in_dec.dec_pos" field of the > interval structure to know if the interval is positive or not. Is there > any macro using which I can know if the interval is negative or positive. > If not should I continue with this approach? or can you suggest some > better method to do it. > > Regards, > > Riaz >