1

Good Day,

Would like to request assistance on a formula. I am trying to capture the Day & Month of a field called Contract_Start_Date__c and then add the year today.

For instance Contract Start Date 02/27/2018

I need to copy 02/27. and then I need to make the year Today().

Any help would be greatly appreciated.

1

1 Answer 1

3

You'll need to use four functions in your formula per the formula documentation

Month - Returns the month, a number between 1 (January) and 12 (December) in number format of a given date. Use: MONTH(date) and replace date with the field or expression for the date containing the month you want returned.

Day - Returns a day of the month in the form of a number between 1 and 31. Use: DAY(date) and replace date with a date field or value such as TODAY().

Year - Returns the four-digit year in number format of a given date. Use: YEAR(date) and replace date with the field or expression that contains the year you want returned.

Date - Returns a date value from year, month, and day values you enter. Salesforce displays an error on the detail page if the value of the DATE function in a formula field is an invalid date, such as February 29 in a non-leap year.

Use: DATE(year,month,day) and replace year with a four-digit year, month with a two-digit month, and day with a two-digit day.

Putting in all together using your example:

Date(Year(Today()), Month(Contract_Start_Date__c) Day(Contract_Start_Date__c))

When Contract_Start_Date__c is 02/27/2018 the formula above will return 02/27/2019

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .