Re: conversion of Unix epoch time to a datetime value
Posted in 1998
Graham Bartlett wrote: > > I have an ASCII file containing times held as the number of seconds from > 1970 and am wanting to load this value into an Informix table to give a > datetime value. As a datetime value is held as an integer is there an easy > procedure within ISQL to enable this ? Actually datetime is not an integer, Informix DATE type is integer but contains only days since 12/31/1979 (ie 1/1/1980 is day 1). Type DATETIME is stored as a DECIMAL type internally with separate base 100 digits for year(2), month, day, hour, minute, second, and fraction (1-3 digits). Use the "C" library function cftime() to convert you UNIX style time to a string in the format Informix expects for a DATETIME type column and insert that string. Function cftime() allows you to specify a format string for the resulting output. Art S. Kagel