RE: Date calculation gives strange format
Posted in 1997
Topics: SQL Development & Query Writing
The format in the third statement is datetime which is a result of adding an interval value (1 units month) to a date. Adding an integer (1) to the date does not cause this conversion, so the format is still date. Refer to the SQL Tutorial for more info.. Tom Boldt on!Contact Software Corporation "Adaptable Solutions for Today's Sales Organization" mailto:tom@oncontact.com http://www.oncontact.com }---------- }From: Richard Thomas[SMTP:richardt@TheMusicStore.co.uk] }Sent: Wednesday, April 23, 1997 7:19 AM }To: informix-list@rmy.emory.edu }Cc: keng@TheMusicStore.co.uk }Subject: Date calculation gives strange format } } }Hi, } }This is probably a "feature", but I'll ask anyway. I've been experimenting }with date calculations, and I'm getting some odd results. Check out the }following select statements: } }select date('1/4/1997') from uniq; }select date('1/4/1997') + 1 from uniq; }select date('1/4/1997') + 1 units month from uniq; } }(uniq is just a table with one column and one row - useful for this type of }test!) } }These give the following output: } }01/04/1997 } }02/04/1997 } }1997-05-01 } }The first two are what I would expect and desire from this sort of statement. }The third is completely useless to me! DBDATE has no effect on the output }of the third statement, and I suspect the influence of the datetime datatype }(this looks to me like datetime year to day). The problem is that we have }very few datetime columns in our database (third party application, no way }of changing them even if we wanted that sort of accuracy - which we don't!) }and we want to use the output of a statement like this to compare with }dates in our data. } }Does anyone know how to get the third statement to output in DMY4/ }format? } }Thanks in advance, } }Richard. } }