on 08-04-2015 2:00 PM
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.
Hi Ramnath,
Could you please mark the answer as 'Correct Answer', so that it would be helpful for others too
Thanks,
Pragati
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Pragati Gupta and Deepak Varandani
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just use addmonths (<yourcolumn>, -1) or addmonths (<yourcolumn>, 1).
Cheers,
Deepak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.