function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Phani PYDIMARRY 11Phani PYDIMARRY 11 

I am trying to get a date one month ago from now

Hello,

I would want to get last month date from today. But I am wondring how can I get the Year if the current date is 01/21/2020. Below is the formula I am using
{!TEXT( MONTH( TODAY()-1))}%2f{!TEXT( DAY( TODAY()-30))}%2f{!TEXT( YEAR( TODAY()))}

I hope the Salesforce Legends can solve my case.

Thanks
Best Answer chosen by Phani PYDIMARRY 11
AbhishekAbhishek (Salesforce Developers) 
Hi Phani,


As of Spring '18, you can use the ADDMONTHS() function to add months to a date. See the documentation here(https://help.salesforce.com/articleView?id=customize_functions_a_h.htm&type=5)

and the release note here(https://releasenotes.docs.salesforce.com/en-us/spring18/release-notes/customize_functions.htm)

And follow the suggestions as mentioned in the below article,

https://salesforce.stackexchange.com/questions/125981/how-do-i-add-6-months-to-a-date-field-in-a-formula

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.

All Answers

AbhishekAbhishek (Salesforce Developers) 
Hi Phani,


As of Spring '18, you can use the ADDMONTHS() function to add months to a date. See the documentation here(https://help.salesforce.com/articleView?id=customize_functions_a_h.htm&type=5)

and the release note here(https://releasenotes.docs.salesforce.com/en-us/spring18/release-notes/customize_functions.htm)

And follow the suggestions as mentioned in the below article,

https://salesforce.stackexchange.com/questions/125981/how-do-i-add-6-months-to-a-date-field-in-a-formula

I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.

Thanks.
This was selected as the best answer
Phani PYDIMARRY 11Phani PYDIMARRY 11
Added ADDMONTHS( TODAY() ,-1) istead of TODAY()-1 and extracted Month Date and Year. It worked. Thanks Abhishek