Re: Question on converting date
Posted in 1993
Topics: General Discussion
>From: ricm@gruntwork.sps.mot.com (Richard Moeller) >Subject: Question on converting date >Date: Fri, 8 Oct 1993 20:45:18 GMT >X-Informix-List-Id: <news.4554> > > I am trying to read a character field of a date ("10/08/93") and I need >to convert this to the date format. What is the best way to do this and >how can I subtract 7 days from this for comparison in a where clause. >(This is in making a report with Informix SQL ver 4.00) Any help would be >appreciated. (a) Why not INPUT it into a DATE variable? (b) If the date is being stored in a CHAR field, don't do it -- store it in a DATE field. One reason for that is that the turn of the century is not far away and will play havoc with programs that use CHAR(8) with separator to store dates. (c) You can coerce a string to a date by using DATE(string). (d) You can do arithmetic on dates: DATE(string) - 7 means a week ago. SELECT DATE("10/3/93") - 7 FROM SysTables WHERE Tabid = 1 AND DATE("10/3/93") - 7 > "01/10/92"; Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
Pardon the pun. I am looking to get some message archived for the informix-list. I can ftp to the site mathcs.whatever, OK. But - when I cd to /pub/informix, I cannot find meaty message files. All I see are the index files with the subject header. Where are the actual bodies of the message themselves ? Brady Hartman Ategra Systems