In this Salesforce Tutorial, we will learn how to add year-to-date in Salesforce. Moreover, we will go through the steps to add the Year-to-Date Field in Salesforce.
In addition, we will go through a special case based on the user’s requirements. The special case is “Salesforce Formula Add Year To Date, where the End Date should be one day before the Start Date, only the Year will change”.
In Salesforce, there are many scenarios where we need to add year-to-date data, such as Sales Forecasting, Contract Management, Project Planning, Product Expiry, License Warranty, etc.
In all these situations, we need to add Year-to-Date in Salesforce. So, if you want to explore how to add year-to-date in Salesforce.
The following are the topics that we will cover in this Salesforce Tutorial:
- Salesforce Date Field
- Salesforce Day Function
- Salesforce Month Function
- Salesforce Year Function
- Salesforce Date Function
- How to add Year to Date in Salesforce
- Add Year to Date using Advance Formula in Salesforce
- In Salesforce Formula Add Year To Date, where the End Date is one day before the Start Date, only the Year will change.
Salesforce Date Field
In Salesforce, the Data Type represents the type of data we can store in a field of an object. And Date is one of Salesforce’s standard data types.
It is used to store and manipulate the record’s data in a field of the object. To store data in the Date Field, we use the standard date format.
The Date Field Format is as given below:
YYYY-MM-DDHere, YYYY represents the year in 4 digits, MM represents the month in 2 digits, and DD represents the day in 2 digits. For example, the Date Field is “2023-03-29” which represents March 29th, 2023.
With this, we have learned about the Salesforce Date Field. Now, we will move ahead and learn about the different Date Field functions in Salesforce.
Salesforce Date Field Functions
In Salesforce, we have several functions related to the Date Field. These functions extract the Date, Month, Year, and Day from a Date.
Let’s discuss each of these functions briefly.
Salesforce Day Function
In Salesforce, the DAY() function returns the day of the month from a date.
The syntax of the DAY function is as follows:
DAY(date)Salesforce Month Function
In Salesforce, the MONTH() function returns the month of the year from a date.
The syntax of the MONTH function is as follows:
MONTH(date)Salesforce Year Function
In Salesforce, the YEAR() function returns the year from a date.
The syntax of the YEAR function is as follows:
YEAR(date)Salesforce Date Function
In Salesforce, the DATE() function returns a date value with year, month, and day components.
The syntax of the DATE function is as follows:
DATE(year, month, date)As a result, we have learned about various functions related to the Salesforce Date Field. Now, we will move on to see the formula for Add Year-to-Date in Salesforce.
How to add Year to Date in Salesforce
In Salesforce, to add a specific number of years to a Date value, we use the Date() and Year() functions together.
Here is the syntax to add Year to Date in Salesforce:
DATE(YEAR(date_field) + No.of years,MONTH(date_field),DAY(date_field))In this code, enter the API name of the date field we want to add a year to. This formula returns a new date that is one or more years after the original.
Let’s understand it in detail with the help of an example:
Let’s say we want to create a formula to determine the Product’s Expiry by adding 1 year to the Manufacturing Date. And, here is the formula for this:
DATE(YEAR(Mfg_Date__c)+1, MONTH(Mfg_Date__c), DAY(Mfg_Date__c))Moreover, in this article, we will learn how to determine whether a year is a leap year and create a formula to add the year-to-date.
With this, we have learned the formula to add year-to-date in Salesforce. Now, we will move further and see how to add year-to-date in Salesforce.
Add Year to Date Using an Advanced Formula in Salesforce
Here are the steps to add Year-to-Date using the Advanced Formula in Salesforce Lightning.
- Log in to your Salesforce account and navigate to Setup. On the left-hand menu, click on Object Manager.

- Click on the object for which we want to add a year-to-date. Here, I select the Product object from the list of objects.

- In the left-hand menu of the object page, click on Field & Relationship. Click on the New button to create a new Field and Relationship.

- Select the field type. Here, I select the Formula as the field type. Click Next to continue.

- Enter a Field Label for the new field, and the Field Name will be automatically populated. Here, I enter the Field Label as Product Mfg. Select Date as the Formula Return Type, and click Next.

- In the Advanced Formula editor, enter the formula to Add Year to Date. Here is the formula, copy and paste it:
IF(
MONTH(Product_Mfg__c)=2 && DAY(Product_Mfg__c)=29,
DATE(YEAR(Product_Mfg__c)+1, 2, 28),
DATE(YEAR(Product_Mfg__c)+1, MONTH(Product_Mfg__c), DAY(Product_Mfg__c))
)- Here, we first check whether the Product Mfg is in February for the given year. If it is, it will add 1 year to the date and return February 28 of that year.
- Otherwise, add 1 year to the Product Mfg date to exactly calculate the date with 1 year added.
Note: Replace the Product_Mfg__c field with the API name of the date field that you want to modify.
- To make sure the formula is valid, click Check Syntax. Optionally, we can add the Description and Help Text, and specify how you want to handle the blank field. Click Next if the syntax is correct.

- Choose the suitable field-level security. Here, I checked the Visible checkbox to make it visible to all. Click Next.

- Choose the Page Layout option and click Save.

- Once the formula is created, open the Products object, create a new product with the Product Mfg value, and save it. After that, click the Details section, and we will see the Product Expiry field with a date value that is 1 year ahead.

With this, we have learned to add the Year to Date field using the advanced formula in Salesforce.
Conclusion
In conclusion, we have learned about the Salesforce Date Field. In addition, we have also explored the Salesforce DATE, DAY, MONTH, and YEAR functions, which are used to return the Date field.
In addition to this, the following are the topics that we have discussed:
- Salesforce Date Filed
- Salesforce Day Function
- Salesforce Month Function
- Salesforce Year Function
You may also like:
- How to add 1 month to Date in Salesforce
- Add Days to Date in Salesforce Formula
- How to add Quick Text in Salesforce
- Salesforce ADDMONTHS Function
I am Bijay Kumar, the founder of SalesforceFAQs.com. Having over 10 years of experience working in salesforce technologies for clients across the world (Canada, Australia, United States, United Kingdom, New Zealand, etc.). I am a certified salesforce administrator and expert with experience in developing salesforce applications and projects. My goal is to make it easy for people to learn and use salesforce technologies by providing simple and easy-to-understand solutions. Check out the complete profile on About us.