Re: How to convert integer to datetime (SMI)
Posted in 1998
partha@fcmc.com wrote: > > There are certain fields in the SMI tables which have an integer column that > represents a time (i.e. syssessions.connected). How do I convert this to the > real date & time? After a little experimentation, I conclude that syssessions.connected is the number of seconds since 1997-01-01 00:00:00 GMT when the user connected to the Online instance. So: SELECT datetime( 1970-01-01 00:00:00 ) year to second + connected units second from syssessions will give you the datetime the user connected Greenwich Mean Time. You'll need to increment/decrement hours based on your timezone to get local times (which could be written as a stored procedure, and is left as an exercise to the student (unless the student asks nicely)). //////////////// ======================================================= ////////// // Dennis J. Pimple Informix Software, Inc. ////// / /// Principal Consultant 6300 S Syracuse Way Ste 205 ///// // //// dennisp@informix.com Englewood CO 80111 //// // ///// /// // ////// recept: 303-850-0210 // // /////// direct: 303-740-5611 Opinions expressed are mine, / /////////// fax: 303-779-4025 and do not necessarily //////////////// http://www.informix.com reflect those of my employer