Re: converting date_time to seconds
Posted in 1996
Art Mills wrote:
>
> how can I convert date_time to full seconds
> this is basicly what I am trying to do
>
> unload to filename> select EXTEND("1996-11-20 18:27:07",YEAR TO SECOND)-date_time",login,........
>
> But I nead the answer in seconds differnt not in YEAR TO SECOND format
>
> example if date_time has "1996-11-20 18:25:07"
> the unload would look like
> 120|aem|..................
The only way I can get it to work is via a TEMP TABLE:
CREATE TEMP TABLE try
(try_dt DATETIME YEAR TO SECOND);
INSERT INTO try VALUES (CURRENT);
CREATE TEMP TABLE temptry (try_int INTERVAL SECOND(5) TO SECOND);
INSERT INTO temptrySELECT EXTEND("1996-11-23 00:00:00", YEAR TO SECOND) - try_dt
FROM try;
UNLOAD TO try.ul SELECT * FROM temptry;
Make sure that you scale the INTERVAL appropriately; a single day has
86400 seconds, so if your math has the possibility of covering several
days you'll have to increase the size of SECOND(5).
//////////////// =======================================================
////////// // Dennis J. Pimple Informix Software, Inc.
////// / /// Principal Consultant 5299 DTC Blvd Suite 740
///// // //// dennisp@informix.com Englewood CO 80111
//// // /////
/// // ////// recept: 303-850-0210
// // /////// direct: 303-740-5611 Opinions expressed are mine,
/ /////////// fax: 303-843-6408 and do not necessarily
//////////////// http://www.informix.com reflect those of my employer