In this Salesforce Tutorial, we will learn the formula to Convert DateTime to Date in Salesforce. Moreover, we will go through the steps using which we can Convert DateTime to Date in Salesforce Lightning and Salesforce Classic.
While working in an organization that uses Salesforce as a CRM tool, I got a task where I need to perform an operation on the date portion of the datetime field. So, to fulfill this requirement, I use the Convert DateTime to Date functionality of Salesforce.
If you want to learn How to Convert DateTime to Date using Salesforce Lightning and Salesforce Classic, you have come to the right place.
The following are the topics that we will cover in this salesforce tutorial:
- Convert DateTime to Date
- How to Convert DateTime to Date in Salesforce Lightning
- How to Convert DateTime to Date in Salesforce Classic
Convert DateTime to Date
In Salesforce, Datetime, and Date are different data types we can use them interchangeably. To perform any operations or comparisons on Date and Datetime values, we always need to convert them to the same data type.
So, to convert datetime field to a date field using advance formula, we use the DATEVALUE function of Salesforce.
Here, is the syntax to convert DateTime to Date in Salesforce:
DATEVALUE(datetimefield)
If, you want to learn in detail about DATEVALUE() function, read Date Formula Functions in Salesforce.
How to Convert DateTime to Date in Salesforce Lightning
Here, are the steps to convert DateTime to Date using the Advance Formula in Salesforce Lightning.
Step 1: Navigate to Salesforce Setup, by clicking on the Setup icon on the upper right side of the page.
Step 2: On the left side of the menu, click on Object Manager.

Step 3: Search for the object to which we want to convert the DateTime to Date. Here, I select the Payments object from the list of objects.

Step 4: Click on Fields & Relationships.
Step 5: Then, click on New.

Step 6: Choose the Formula as the field type.
Step 7: To continue, click Next.

Step 8: Enter a Field Label for the formula, and the Field Name will be automatically populated. Here, I enter Field Label as the CancelPayDate.
Step 9: Choose Date as the Formula Return Type. Then, click Next.

Step 10: Enter the DateTime to Date formula in the Advance Formula editor. Here, is the formula:
DATEVALUE(CancellationDate)
- In this formula, we convert the datetime field called “CancellationDate” to the date field using the DATEVALUE Salesforce function.
Step 11: Click Check Syntax to make sure the formula is correct.
Step 12: We can add the Description and Help Text as options, and we can also state how you want to handle the blank field.
Step 13: After that, click Next.

Step 14: Select the appropriate field Level Security and to make it visible to everyone, here we select the Visible checkbox.
Step 15: Select Next.

Step 16: Choose the Page Layout Name, for whom we want to add the formula field.
Step 17: To save the formula field, click Save.

We can use the formula field once we’ve created it. Let’s look at an example:
- Create Payments with Cancellation Date value field by opening the Payments object and saving it.
- After that, click on the Details section, and here the Cancel Pay Date field will appear in the date data type format instead of the datetime data type.

As a result, we now know how to use Salesforce Lightning’s advanced formula to convert DateTime to Date. Next, we’ll look at how to use Salesforce Classic’s advance formula to convert DateTime to Date.
Read Salesforce Formula Date to Text
How to Convert DateTime to Date in Salesforce Classic
Here, are the steps to Convert DateTime to Date using the Advance Formula in Salesforce Classic.
Step 1: From the Salesforce Lightning to open your Salesforce Classic edition. Click on Avtar and click Switch to Salesforce Classic.

Step 2: Click on the Setup option.

Step 3: Scroll down to the Build section. Then under Customize, select the object for whom we want to convert the DateTime to Date. Here, I choose the Accounts from the object list.
Step 4: Click on the dropdown menu and select Fields.

Step 5: As you scroll down the page, click on the New button under Custom Fields & Relationships.

Step 6: Select the Formula as the field type.
Step 7: Click Next to proceed.

Step 8: Enter a Field Label for the formula, and the Field Name will be automatically populated. Here, I enter Field Label as the Create Date.
Step 9: Choose Date as the Formula Return Type and then click Next.

Step 10: Enter the formula to convert the DateTime to Date in the advance formula editor. The formula is as follows:
DATEVALUE(CreatedDate)
Step 11: To verify that the formula is valid, click Check Syntax.
Step 12: We can specify how you want to handle the empty field and include the Description and Help Text optionally.
Step 13: Then, click Next.

Step 14: Choose the appropriate Field’s Level Security, and then check the box Visible to make it visible to all.
Step 15: Click Next.

Step 16: Choose the Page Layout Name for which the formula field is to be added.
Step 17: Click Save to save the formula field.

Once we’ve defined the formula field, we may use it. Let’s explore an example:
- Create a new case with the Entitlement Process Start Time field value by opening the cases object and saving it.
- After that, click on the Details section, and here the Process Start Date field will appear in the date data type format instead of the datetime data type.

In a conclusion, we now understand how to convert DateTime to Date using Salesforce Classic’s advanced formula.
Also, Read
Conclusion
In conclusion, we have learned the advance salesforce formula to convert DateTime to Date. Moreover, we have learned that both Salesforce Classic and Salesforce Lightning provide a simple procedure to convert DateTime to Date.
In addition to this, the following are the topics that we have discussed:
- Convert DateTime to Date
- How to Convert DateTime to Date in Salesforce Lightning
- How to Convert DateTime to Date in Salesforce Classic
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.