Re: INSERT TRIGGER to convert UNIX date time to DATE
Posted in 2000
FYI,
There's a stored procedure called l2date() (in sysmaster, I believe)
that does the Unix datetime to Informix date conversion.
--Chuck
> Hi,
> I have a table with a DATE field named COLLECTION_DATE. The table is
> updated by and application which stores a UNIX date time into the
> COLLECTION_DATE field. I would like to modify the input date via a TRIGGER
> to convert it to the INFORMIX date format. I wrote the trigger below.
>
> CREATE TRIGGER DM_METRICS_INSERT> INSERT ON DM_METRICS
> FOR EACH ROW(
> UPDATE DM_METRICS
> SET COLLECTION_DATE = COLLECTION_DATE / 86400 + 71);
>
> Will this trigger do the propper conversion from UNIX datetime to INFORMIX
> date when I insert into the DM_METRICS table?
>
> John