Novice question
Posted in 2000
Topics: General Discussion
Dear all gurus out there, I am new to informix and have a question. My question is: how can i get the dates from say 2 dates? for eg, date 1 is 10/10/2000 date 2 is 20/9/2000 the difference is 20 days if i have a date 3 which is 11/8/2000 the difference for date1 and date3 should be 59 days Are there any functions in informix that i can make use of? or i have to write a function myself? Thank you and have a nice day wee keong
If you are asking how to find the difference then, there is no need for a function. Select date3 - date1 from ..... will give you the difference in days. qiang wrote: > > Dear all gurus out there, > > I am new to informix and have a question. > > My question is: > how can i get the dates from say 2 dates? > for eg, > date 1 is 10/10/2000 > date 2 is 20/9/2000 > the difference is 20 days > > if i have a date 3 which is 11/8/2000 > the difference for date1 and date3 should be 59 days > > Are there any functions in informix that i can make use of? or i have > to write a function myself? > > Thank you and have a nice day > > wee keong
Informix stores dates as integers, so you should be able to just subtract one date from another and get the difference in days, as in: SELECT date1-date2 FROM tablename If date1 is 10/10/2000 and date2 is 9/20/2000, this should return 20. "qiang" <qiang@post1.com> wrote in message news:39FEF3DB.47630108@post1.com... > Dear all gurus out there, > > I am new to informix and have a question. > > My question is: > how can i get the dates from say 2 dates? > for eg, > date 1 is 10/10/2000 > date 2 is 20/9/2000 > the difference is 20 days > > if i have a date 3 which is 11/8/2000 > the difference for date1 and date3 should be 59 days > > Are there any functions in informix that i can make use of? or i have > to write a function myself? > > Thank you and have a nice day > > wee keong >