Re: How to convert integer to datetime (SMI)
Posted in 1998
In article <34D0A979.1F0A@informix.com>, Dennis Pimple <dennisp@informix.com> writes >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)). > David (nicely) says "Any chance of a stored procedure?" >//////////////// ======================================================= >////////// // 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 -- David Williams Maintainer of the Informix FAQ Primary site (Beta Version) http://www.smooth1.demon.co.uk Official site http://www.iiug.org/techinfo/faq/faq_top.html I see you standin', Standin' on your own, It's such a lonely place for you, For you to be If you need a shoulder, Or if you need a friend, I'll be here standing, Until the bitter end... So don't chastise me Or think I, I mean you harm... All I ever wanted Was for you To know that I care