Convert Date to Text Using Formula in Salesforce

In Salesforce, Date fields always show in standard date format, like YYYY-MM-DD. But sometimes, we need the Date in Text format for emails or reports.

Salesforce does not directly allow us to change Date to Text without using a formula.

For example, if we are sending an email and want to include the Date field, it will display in system format (YYYY-MM-DD). This may not look good for end users. By converting the Date into Text using a formula, we can show it as “September 17, 2025.”

In this article, we will learn about how to convert a date to text using a formula in Salesforce. In this, I will create and explain a formula using functions that display dates in text format.

Salesforce Formula Date to Text

In Salesforce, to convert the date field to a text data type, we use the Salesforce DATE() and TEXT() functions together.

Here is the syntax to convert a date to text in Salesforce:

TEXT(DATE(datefield))
#OR
TEXT(datefield)

In this code, enter the API name of the date field you want to convert to time for the Date Field. And this formula returns a new date in text format.

Let’s understand it in detail with the help of an example:

Let’s say we want to create a formula that returns only a year, but without the number place separated with commas. So, for this, we will create a formula that converts a Year to Text in Salesforce.

Here is the formula for this:

TEXT(YEAR(datefield))

Convert Date to Text Using Formula in Salesforce

Here are the steps to convert a Date to Text using the Advanced Formula in Salesforce Lightning.

  1. Go to the Gear Icon. -> Click on the Setup. -> Select the Object Manager tab. 
Salesforce Formula Date to Text
  1. Search for the object to which we want to convert the Date to Text. Here, I select the Accounts object from the list of objects.
Salesforce Formula Date to Text Example
  1. In the Account object setup, click on the Fields and Relationships to create a new field and click the New button.
Convert Date to Text Using Formula in Salesforce
Salesforce Lightning Formula Date to Text
  1. In this step, we will use a formula to convert the date into text format and display it on the account object. For that, select the option Formula from the data type and click Next.
Salesforce Lightning Example Formula Date to Text
  1. Next, provide the Field Label and API Name for the formula field. Then, since we want to convert and display the date in text format, in the  Formula Return Type, select Text and click on the Next button.
Convert Date to Text Formula in Salesforce Lightning
  1. Enter the Date to Text formula in the Advanced Formula editor. Here is the formula:
TEXT( DATE ( YEAR( SLAExpirationDate__c ), MONTH( SLAExpirationDate__c ), DAY( SLAExpirationDate__c ) ) )
  • In this formula, we extract the date from the custom field called “SLAExpirationDate__c” using the DATE, YEAR, MONTH, and DAY Salesforce functions. But by default, the DATE function returns the result in a date format.
  • To get the result in the text format, we will use the TEXT function with the DATE function.
  • Click Check Syntax to make sure the formula is correct. After that, click Next.
Convert Date to Text Formula in Salesforce Lightning Example
  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.
How to Convert Date to Text Formula in Salesforce Lightning
  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.
How to Convert Date to Text Formula in Salesforce Lightning Example

We can use the formula field once we’ve created it. Let’s look at an example:

  • Create or Open an account using the SLA Expiration Date value by opening the Accounts object and saving it.
  • After that, click on the Details section, and here the Text SLA Expiry Date field will appear in the text datatype format instead of the date datatype.
Convert Date to Text Using Formula in Salesforce

As a result, we now know how to use Salesforce Lightning’s advanced formula to convert a Date to Text. Next, we’ll look at how to use Salesforce Classic’s advance formula to convert Date to Text.

Conclusion

In conclusion, we have learned the advanced Salesforce formula to convert a Date to Text. Moreover, we have learned that both Salesforce Classic and Salesforce Lightning provide a simple procedure to convert a Date to Text.

In addition to this, the following are the topics that we have discussed:

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.