This is a discussion on Re: days between dates within the Informix forums, part of the Database Server Software category; --> Bill Hamilton wrote: > Yes, they are datetime year to second. > date1 - date2 returns an "interval" So ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Bill Hamilton wrote: > Yes, they are datetime year to second. > date1 - date2 returns an "interval" So convert them to DATE before subtracting: SELECT DATE(dtime1) - DATE(dtime2) ... > ----- Original Message ----- > From: "John Carlson" <john_carlson@whsmithusa.com> > >>On Fri, 22 Aug 2003 10:04:27 -0500, "Bill Hamilton" <bham@finsco.com> >>wrote: >>> GlacierI would like to select into a temp table the number of >>> days between 2 dates, but that gives an INTERVAL type. Is there >>> anyway to get that as an INT? (in IDS 7.31) >>> >>>I suppose one could use the month,day,year functions. >>>Is that the only way? >>> >> >>Strange . . . . . >>date1=9/9/03 >>date2=9/13/03 >>both are defined as date >> >>select (date2-date1) >>from jctmp1 >> >>returns: 4 >> >>those two dates that you mentioned . . . . are they datetime instead >>of date? -- Jonathan Leffler #include <disclaimer.h> Email: jleffler@earthlink.net, jleffler@us.ibm.com Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/ |