Calculate Previous Month with year
Posted: Wed Sep 20, 2017 10:13 am
I have requirement where I need to populate the Column 'BK' with previous month with year.
Column - BK - Datatype - Number(6)- Format -YYYYMM
Current month, the job should run for previous month data based on the BK.
I tried the option MonthFromDate(CurrentDate())-1 ---> it is giving '8' for today. I want it as '08'
Like that I can take yearfromDate() and concatenate.
But the problem will be when next year 2018 comes, this above logic won't work.
Please let me know if there is any function to do this.
Thanks.
Column - BK - Datatype - Number(6)- Format -YYYYMM
Current month, the job should run for previous month data based on the BK.
I tried the option MonthFromDate(CurrentDate())-1 ---> it is giving '8' for today. I want it as '08'
Like that I can take yearfromDate() and concatenate.
But the problem will be when next year 2018 comes, this above logic won't work.
Please let me know if there is any function to do this.
Thanks.