You need to sign in to do that
Don't have an account?
Chris High
Field update to calculate LAST DAY of the month, 1 year later.
I found some posts regarding adding a year to a date, and even calculating the FIRST day of a following month. But my effort to reverse engineer these was fruitless. For our contracts, whatever a rep enters as the START date, we want the END date to auto-populate (upon saving) for one year later, but the LAST DAY of whatever that month happens to be.
So I need it to calulate DATE of Start_date__c + 1 year, + 1 month, minus 1 day
That's do-able right? Thanks in advance!!
So I need it to calulate DATE of Start_date__c + 1 year, + 1 month, minus 1 day
That's do-able right? Thanks in advance!!
As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.
Thanks
All Answers
start date = 2/2/2015, end date =?
start date = 3/1/2015, end date =?
start date = 4/30/2015, end date =?
start date = 1/1/2015, end date =?
Thx
start date = 3/1/2015, end date = 3/31/2016
start date = 4/30/2015, end date = 4/30/2016
start date = 1/1/2015, end date = 1/31/2016
As a common practice, if your question is answered, please choose 1 best answer.
But you can give every answer a thumb up if that answer is helpful to you.
Thanks
You can use this formula to fulfil your requirement. Create a Formula field with return type as Date and use this:
Let me know, if you need any other help.
Thanks,
Neetu
1. If you want to arrive at the next day.
IF(MONTH([-- DATE --]) < 12,
DATE(YEAR([-- DATE --]), MONTH([-- DATE --]) + 1, 1),
DATE(YEAR([-- DATE --]) + 1, 1, 1))
2. If you want to arrive at the exact day
IF(MONTH([-- DATE --]) < 12,
DATE(YEAR([-- DATE --]), MONTH([-- DATE --]) + 1, 1),
DATE(YEAR([-- DATE --]) + 1, 1, 1)) - 1
Someone please help?
DATE
(
YEAR(DATEVALUE([Case].CreatedDate))+1,
MONTH(DATEVALUE([Case].CreatedDate)),
CASE(MONTH(DATEVALUE([Case].CreatedDate)),
1, 31,
2, IF(MOD(YEAR(DATEVALUE([Case].CreatedDate)), 4) = 0, 29, 28),
3, 31,
4, 30,
5, 31,
6, 30,
7, 31,
8, 31,
9, 30,
10, 31,
11, 30,
12, 31,
0
)
)
Eu tive problemas em usar a formula do "William Tran", ela deu erro quando o mês em dezembro. Segue uma nova sugestão para não dar erro quando estivermos no mês de dezembro e avançamos para o próximo ano.
How to calculate the end day of the month:
DATE(YEAR(ADDMONTHS(Start_date__c, 1)), MONTH(ADDMONTHS(Start_date__c, 1)), 1) - 1
To get last day of the month, of exactly one year from now, should be good enough to use the following formula:
This will handle automatically any date inconvenient... and will compile with 164chars vs. the corrected formula above (179) which depending on where you will use this, it might matter.
Cheers.
IF( MONTH( date ) = 12, DATE( YEAR( date ), 12, 31 ), DATE( YEAR( date ), MONTH ( date ) + 1, 1 ) - 1 )
https://help.salesforce.com/s/articleView?id=sf.formula_examples_dates.htm&type=5