You need to create a formula field with Date Field Type and use Below formula field
DATE( YEAR(Start_date__c), MONTH(Start_date__c), CASE( MONTH(Start_date__c), 1, 31, 2, IF( MOD( YEAR(Start_date__c), 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 ) )
An alternate method from the Salesforce documentation: Finding the Last Day of the Month
The easiest way to find the last day of a month is to find the first day of the next month and subtract a day.
IF(
MONTH( date ) = 12,
DATE( YEAR( date ), 12, 31 ),
DATE( YEAR( date ), MONTH ( date ) + 1, 1 ) – 1
)
Source: https://resources.docs.salesforce.com/206/latest/en-us/sfdc/pdf/formula_date_time_tipsheet.pdf
LikeLiked by 1 person
Thanks for your alternative solution.
LikeLike