local date/time.
Posted in 2003
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Does any one know, having retrieved a utc date/time from a field, whether one may use ESQL (infx) functions to convert it to local time (that is local time as local time was at the time of the time retrieved, if you know what I mean) or whether I must manage this through my O/S functions. Many thanks, Andrew H. sending to informix-list
Andrew Hardy wrote: > Does any one know, having retrieved a utc date/time from a field, whether > one may use ESQL (infx) functions to convert it to local time (that is > local time as local time was at the time of the time retrieved, if you know > what I mean) or whether I must manage this through my O/S functions. > > Many thanks, > > Andrew H. > > > sending to informix-list Um, what "kind" of a date or time? Informix date, Informix datetime, UNIX time? If it's datetime, just add (or subtract) whatever the offset is; e.g., in the US Eastern Time Zone, add 5 hours (and fiddle with DST as appropriate). You can do that with Informix library functions in ESQL/C (see section 6 of the ESQL/C Programmer's Manual). If it's UNIX time -- the number of seconds since the epoch -- use the localtime() function in the C library (man localtime). If you don't know how to do that, let me know and I'll send you a sample. If it's Informix date, you're stuck -- that's a number of days.