Working with datetime variables
Posted in 1999
Topics: General Discussion
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01BF0A45.41DDF670 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit ****** Message from InterScan E-Mail VirusWall NT ****** ** No virus found in attached file noname Mail Scanned For Virus At ITLInfosys ***************** End of message *************** ------_=_NextPart_001_01BF0A45.41DDF670 Content-Type: text/plain 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 ------_=_NextPart_001_01BF0A45.41DDF670 Content-Type: text/html Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Dus-ascii"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2448.0"> <TITLE>Working with datetime variables</TITLE> </HEAD> <BODY> <P><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">Hi all,</FONT> </P> <P> <FONT COLOR=3D"#0000FF" = SIZE=3D2 FACE=3D"Arial">Here is a small program where I want to compare = two datetime and know which one is greater.</FONT> </P> <P><FONT COLOR=3D"#0000FF" SIZE=3D2 = FACE=3D"Arial"> &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; </FONT></P> <P><FONT COLOR=3D"#0000FF" SIZE=3D2 = FACE=3D"Arial">main() &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; </FONT> <BR><FONT COLOR=3D"#0000FF" SIZE=3D2 = FACE=3D"Arial">{ &n= bsp; &n= bsp; &n= bsp; &n= bsp; &n= bsp; &n= bsp; </FONT> <BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial"> = $datetime year to fraction(3) = upd_time; &nb= sp; &nb= sp; &nb= sp; </FONT> <BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial"> = $datetime year to fraction(3) = tmp_time; &nb= sp; &nb= sp; &nb= sp; </FONT> <BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial"> = $interval day to fraction(3) = inv_time; &nb= sp; &nb= sp; &nb= sp; </FONT> <BR><FONT COLOR=3D"#0000FF" SIZE=3D2 = FACE=3D"Arial"> &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; </FONT> <BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial"> = $database = crd; &n= bsp; &n= bsp; &n= bsp; &n= bsp; &n= bsp; </FONT> <BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial"> = $select upd_dtm into $tmp_time from = gblupd_dtm; &= nbsp; &= nbsp; </FONT> <BR><FONT COLOR=3D"#0000FF" SIZE=3D2 = FACE=3D"Arial"> &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp; &nb= sp;