[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Adding Number Column to Date Column
You should be able to do what you want using "julian" date logic.
For instance, try the following:
begin-select
to_date(to_char(incident_dt,'J')+restricted_days,'J')
from [table]
end-select
This should give you a result date without having to worry about whether
adding your "days" exceeds the end of the month, etc., which is what you
would have to do if you extracted the "DD" out of the date format, added
the "days", etc.
Good luck!
/
>
> I am having a problem doing date arithmetic in my SQR:
>
> I've got two columns:
> incident_dt date format
> restricted_days number format
>
> In my SQR all I want to do is add the restricted_days to the incident_dt and
> print out the result as a date. For example if the incident_dt is 12/18/95 and
> the restricted_days is 2 then I want the result to be 12/20/95. Any help is
> greatly appreciated.
>