Re: reading timestamp from audit trail files
Posted in 1996
Mike Segel <mikey@segel.com> wrote: :Kleanthis Goozis wrote: :> :> Informix's Techinfo document #782 describes the format of :> the audit trail header as follows: :[SNIP] ww - after update :> :> 3-6 integer A 4 byte :> representation :> of the date :> and time :> (number of :> seconds :> since Janu- :> ary 1 , 1970.) :> :[SNIP] :> Any ideas of how to translate (using SQL) the timestamp (bytes 3-6) to a :> human readable format (something like mm/dd/yy mm:ss)? :Well, first the *integer* is an Informix *integer*. A C long. :THis may be machine dependant. :But I digress..... :If your trying to use SQL/4GL, just set a date variable = to this. :then you can format your output accordingly. The fild is already a date. :Hope this helps :-Mikey Mikey, I allways believed a date in Informix was represented in an integer as the number of days from 1899/12/31 or something like that, but I may be wrong. He asked about SQL however and should be able to do something like: select extend (mdy(1,1,1970), year to second) + ww units second from table_where_data_is This may easily be off by 24 hours, 1 second or whatever, but some experimentation will fix that. The output will of course be formated as yyyy-mm-dd hh:mm:ss Essentially the same thing can of course be done in a stored procedure, 4GL, ESQL/C or other languages where any format can be achieved. If the above gives all wrong results Mikey's advice about integer format is where to look. Nils.Myklebust@ccmail.telemax.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company