Re: preparing Date Time Year To Second for last 24 hours
Posted in 1998
Sukumar Konduru <sukumar@gte.net> asked:
>I have a database column "date time year to second".
>I need to prepare SQL statement to do get the results for last
>24 hours.
>
>For example If current date and time are 06/02/98 10:25:00
>then I need query like this.
>
>select * from xxx
>where start <="1998-06-02 10:25:00"
>and>start >= "1998-06-01 10:25:00"
>
>I want to know in ESQLC or SQL
>1. How to find current date and time in "year to second"?
SQL: CURRENT YEAR TO SECOND
ESQL: dtcurrent()
>2. How to mainpuate above to get date for exactly for 24hours back ?.
Well, simply write what you asked for:
SELECT *
FROM xxx
WHERE Start BETWEEN CURRENT YEAR TO SECOND - 24 UNITS HOUR
AND CURRENT YEAR TO SECOND;
Yours,
Jonathan Leffler (jleffler@informix.com) #include <returned.h>