0 pts.
 function to subtract 200 days from date
I need to write the filter condition in cognos as follows: YRMOSDOS between (&YRMOSDOS - 200) AND (&YRMOSDOS) where YRMOSDOS is in date form. How do I achieve it? The database is in db2. Decimal function does not work. Please help. Thanks a lot.

Software/Hardware used:
ASKED: June 24, 2005  11:20 AM
UPDATED: June 29, 2005  7:51 AM

Answer Wiki:
I think you need to cast the field to a date and use the DAYS keyword on the number of days... i.e.: WHERE &YRMOSDOS between (DATE(&YRMOSDOS) - 200 DAYS) AND (DATE(&YRMOSDOS))
Last Wiki Answer Submitted:  June 24, 2005  12:55 pm  by  Jvoteur   0 pts.
All Answer Wiki Contributors:  Jvoteur   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Anytime I have date math I convert to Julian Date. Simple math, easy to work with, and in most languages a faster convert to/from than casting system date to variable.
Good luck.

p.s. Of course I have a roman numeral calculator also.

 30 pts.

 

Couple of quick questions, what version of DB2 are you using? what development environment are you using? and what is the error message you get? If it is a parsing error then you probably aren’t dealing with just a date format issue at this point.

 0 pts.