Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!ernie.Berkeley.EDU!jas From: jas@ernie.Berkeley.EDU (Jim Shankland) Newsgroups: comp.databases Subject: Re: Ingres ESQL/C & Unix date formats Message-ID: <26900@ucbvax.BERKELEY.EDU> Date: 20 Nov 88 23:10:50 GMT References: <42@melba.oz> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: jas@ernie.Berkeley.EDU.UUCP (Jim Shankland) Organization: University of California, Berkeley Lines: 23 In article <42@melba.oz> gnb@melba.oz.au (Gregory Bond) writes: ! I'm trying to use embedded SQL from C, calling the ingres database to ! extract and process data. The problem I'm having is converting Ingres ! dates to unix time(3)-style dates (i.e. #secs since 1/1/70). ! ! Ingres insists on considering dates as 26 character strings. ! The best solution I can find is something like ! [ick...] ! which almost seems to work, but problems with timezones seem to make ! this unreliable (we just went on to DST here...) as Ingres is converting ! the '1/1/70' to local time.... Not to mention SLOW. Here's one suggestion that may or may not work for you: forget the 'date' datatype, and store your dates as i4's representing seconds since 1/1/70, GMT. You lose in the terminal monitor, where you find yourself staring at large integers instead of anything meaningful to a human; but your ESQL/C program gets to do whatever it wants with timezones, formatting, etc. Jim Shankland jas@ernie.berkeley.edu "Work, knowledge, and love are the wellsprings of human existence" -- Reich