cancel
Showing results for 
Search instead for 
Did you mean: 

Month adjustment

Former Member
0 Kudos

Hi,

I have a business scenario where I need to adjust the month based on some calculation in the calculation view.

For Eg, If the start date is Aug 4,2015, I need to change as Jul 4, 2015 or Sept 4,2015 based on scenario. Need to add or minus the months.

How to achieve it.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Ramnath,

Could you please mark the answer as 'Correct Answer', so that it would be helpful for others too

Thanks,

Pragati

Answers (3)

Answers (3)

Former Member
0 Kudos
DeepakVarandani
Explorer
0 Kudos

Just use addmonths (<yourcolumn>, -1) or addmonths (<yourcolumn>, 1).

Cheers,

Deepak

Former Member
0 Kudos

Hi Ramnath,

Based on your business scenario, if you are getting an integer value, as number of months to be added or subtracted to the start date then this might help you:

If the start date is Aug 4,2015 and you need to change as Jul 4, 2015 the syntax will be:

SELECT ADD_MONTHS(TO_DATE ('2015-08-04', 'YYYY-MM-DD'), -1) "DATE" FROM DUMMY;

If the start date is Aug 4,2015 and you need to change as Sept 4, 2015 the syntax will be:


SELECT ADD_MONTHS(TO_DATE ('2015-08-04', 'YYYY-MM-DD'), 1) "DATE" FROM DUMMY;

If you want to use it in calculation view then, create a calculated column and write following in the Expression Editor:

addmonths(<yourcolumn>,-1)

or

addmonths(<yourcolumn>,1)

I hope this might help you.


Thanks,

Pragati