Managing INTERVAL
Posted in 2000
Topics: General Discussion
Hi there, I have a duration field which is calculated from substracting one datetime field by another. The result is an INTERVAL field. However, we need to result to be expressed in seconds only, but not the hour:minute:second format. Can another one help? Thanks!! Kenneth Sent via Deja.com http://www.deja.com/ Before you buy.
Define the duration as: duration INTERVAL SECOND(5) TO SECOND You may have to EXTEND(...) INTERVAL SECOND(5) TO SECOND in the calculation. I don't do this much. Art S. Kagel hktkenneth@my-deja.com wrote: > > Hi there, > > I have a duration field which is calculated from substracting one > datetime field by another. The result is an INTERVAL field. However, > we need to result to be expressed in seconds only, but not the > hour:minute:second format. Can another one help? Thanks!! > > Kenneth > > Sent via Deja.com http://www.deja.com/ > Before you buy.
"Art S. Kagel" wrote: > Define the duration as: > > duration INTERVAL SECOND(5) TO SECOND > > You may have to EXTEND(...) INTERVAL SECOND(5) TO SECOND in the calculation. > I don't do this much. There isn't an extend for intervals. > hktkenneth@my-deja.com wrote: > > I have a duration field which is calculated from substracting one > > datetime field by another. The result is an INTERVAL field. However, > > we need to result to be expressed in seconds only, but not the > > hour:minute:second format. Can another one help? Thanks!! If this is an on-the-fly expression and not being retrieved into a variable (as in SPL or I4GL or ESQL/C) then use the trick: INTERVAL(0) SECOND(9) TO SECOND + (dtime2 - dtime1) Oh Smooth One, this is material for the FAQ if there is not already anything on it in there. Did you try FAQ-O-Matic yet? -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include <disclaimer.h> Guardian of DBD::Informix v1.00.PC1 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"