How to Convert DateTime to Date in Salesforce Formula

In Salesforce, DateTime fields always include both the date and the time, for example: 28-Aug-2025 3:45 PM. However, in many business scenarios, users only need the date.

For example, we want formulas that require comparison with TODAY(), such as checking if a follow-up DateTime matches today’s date. Since TODAY() only returns the date, you need to convert DateTime to Date first.

Because of this, we need to convert DateTime into Date to make data easier to use, compare, and understand.

In this article, we will learn about how to convert a DateTime to a Date in Salesforce Formula. Moreover, we will go through the steps to display the date from the DateTime field in Salesforce.

Convert DateTime to Date in Salesforce Formula

In Salesforce, Datetime and Date are different data types. 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 a DateTime field to a Date field using the advanced formula, we use the DATEVALUE() function of Salesforce.

Here is the syntax to convert a DateTime to a Date in Salesforce:

DATEVALUE(datetimefield)

Example: Create a Formula Field to Display Date From a DateTime Field in Salesforce

Below, I will explain how to extract and display the only Date value from a given DateTime field, allowing it to be used in formulas, reports, or automation within Salesforce.

  1. Here, you can see that the account object contains a Current Date Time field, which displays the date and time value. But we only want to display the date so that we can create the formula field on this object.
Convert DateTime into Date Field in Salesforce
  1. Go to the Gear Icon. -> Click on the Setup. -> Select the Object Manager tab. Select the Object on which you want to create the Formula Field to extract the year from the date. Here, I’m going to create an Account Object.
Create Formula Field in Salesforce
  1. In this step, we will use a formula to convert the DateTime value to display only the Date value from the given DateTime field and display it on the account object. To do this, select the Formula option from the data type and click Next.
Formula Data Type in Salesforce
  1. Next, provide the Field Label and API Name for the formula field. Then, since we want to display only the Date value of the given DateTime field, in the  Formula Return Type, select Text and click on the Next button.
Date Formula Return Type in Salesforce
  1. In the formula editor, enter the formula below and click the Next button. Then select the Function from and click the Insert Selected button to use them. Then, add the date field from the object.
DATEVALUE(Date_Field)
  • In this formula, we convert the DateTime field called “current_date_time__c” to the date field using the DATEVALUE() Salesforce function.
Salesforce Advanced Formula and Functions
  1. Select the Field Level Security for the formula field, and select the profiles to make the field visible for the profiles. The field will be visible for the profiles selected from the Visible column.
    • After selecting the profiles, click on the Next button.
Establish Field Level Security in Salesforce
  1. In this step, we must select the field’s visibility on the object’s page layouts. In this case, we have created the formula field for the reports so we can choose not to display it on the page layouts.
    • Uncheck the checkboxes of the page layouts to prevent the field from displaying on them. After this, click on the Save button.
Add Formula Field to Salesforce Page Layout

We have now created the formula field that returns the date value from the Current Date Time field of the account object.

As you navigate to the object, you will see the formula field that you created to extract and display the date value from the datetime field.

Convert DateTime to Date in Salesforce Formula

In this way, we can create a formula field to store the extracted date from the given datetime field in Salesforce.

Conclusion

I hope you have got an idea about how to convert a DateTime to a Date in Salesforce Formula. Moreover, we have gone through the steps to display the date from the DateTime field in Salesforce.

You may like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.