Page 1 of 1

Date calculation - Logic required

Posted: Wed May 20, 2009 7:08 pm
by savis
Whenever I run the job, the start date and end date should be generated based on the current date.

If I run the job on (Date: 06/01/09 ), then Load the data for 7 Months
Current Month + Next 3 Months : Jun + Jul, Aug, Sept 09
Previous 3 Months : Mar, Apr, May 09
Start date : Mar -01 - 2009
End Date : Sep - 30-2009

If I run the job on (Date: 06/02/09 ), then Load the data for 7 Months
Current Month + Next 3 Months : Jun + Jul, Aug, Sept 09
Previous 3 Months : Mar, Apr, May 09
Start date : Mar -01 - 2009
End Date : Sep - 30-2009

If I run the job on (Date: 07/01/09 ), then Load the data for 7 Months
Current Month + Next 3 Months : Jul + Aug, Sept, Oct 09
Previous 3 Months : Apr, May, Jun 09
Start date : APr -01 - 2009
End Date : Oct - 31-2009

Note: Start date should be first date of the previous third month
and end date should be the last date of the next third month.
(This excludes the current month and should always pull 7 months data).

I am not sure how to do it.

Please help

Posted: Wed May 20, 2009 7:40 pm
by ray.wurlod
Use the AddMonthsToDate() routine from here to calculate a start date and end date, then use MONTH.FIRST and MONTH.LAST transforms.