A sales manager wants to track the date when each high-value opportunity enters the pipeline. The team already has a Date/Time field that records the exact creation moment, but reports only need the calendar date. Showing time alongside the date makes grouping and filtering harder than it needs to be.
I have used this pattern in Sales Cloud projects where teams need clean daily reporting, SLA calculations, and date-based validation rules.
The Salesforce DATEVALUE function removes the time portion from a Date/Time value, giving you a proper date that you can use in formula fields, reports, and Flow logic.
In this guide, you will learn the DATEVALUE syntax, build a working formula field, and use practical examples you can apply in your Salesforce org.
What Is the Salesforce DATEVALUE Function in Salesforce?
The Salesforce DATEVALUE function converts a Date/Time value into a Date value.
A Date/Time field stores both parts of a value. For example:
08/17/2026 2:30 PM
After you apply DATEVALUE, Salesforce returns only the date:
08/17/2026
This function is useful when you need to:
- Group Date/Time records by day in a Report
- Compare a Date/Time field with
TODAY() - Calculate days between a Date/Time field and another date
- Create a date-only value for a Validation Rule
- Use a Date/Time field in an automation condition
- Remove time values from business calculations
Before building the formula, make sure you understand the difference between a Date field and a Date/Time field in Salesforce.
A Date field stores only a day, month, and year. A Date/Time field also stores the exact time.
Salesforce DATEVALUE Function Syntax
Use the following syntax:
DATEVALUE(date_time Field)
For example:
DATEVALUE(CreatedDate)
Here, CreatedDate is a standard Salesforce field that records the date Salesforce created the record. The formula returns only the date from that Date/Time value.
Input and Output Values for DATEVALUE Function in Salesforce
| Item | Details |
|---|---|
| Function name | DATEVALUE |
| Input | A Date/Time field or Date/Time expression |
| Output | A Date value |
| Typical use | Remove the time from a Date/Time field |
| Common examples | CreatedDate, LastModifiedDate, custom Date/Time fields |
Do not confuse DATEVALUE() with the Salesforce DATE function. The DATE function creates a new date from separate year, month, and day values.
DATEVALUE converts an existing Date/Time value into a date.
When Should You Use Salesforce DATEVALUE?
Use the Salesforce DATEVALUE function when your business requirement operates at the calendar-day level rather than at the exact timestamp level.
Let’s use a consistent example. Imagine a Sales Cloud org with 20 account executives who create and update opportunities throughout the day.
The sales operations team wants to report on opportunities created today, measure follow-up dates, and calculate the number of days since a rep last updated an opportunity.
Salesforce stores system fields such as CreatedDate and LastModifiedDate as Date/Time values. DATEVALUE makes those values easier to use in date-only formulas.
Compare a Date/Time Value With Today in Salesforce
This formula checks whether Salesforce created the record today:
DATEVALUE(CreatedDate) = TODAY()
The TODAY function returns the current date without time. DATEVALUE converts CreatedDate into the same data type, so Salesforce can compare the values correctly.
You can learn more about using the Salesforce TODAY function in formulas.
Calculate Days Since a Record Changed in Salesforce
Use this formula to show how many whole calendar days have passed since someone last modified an opportunity:
TODAY() - DATEVALUE(LastModifiedDate)
If the last update happened on August 14 and today is August 17, Salesforce returns 3.
This is useful for a “Days Since Last Activity” formula field. Sales managers can add the field to an opportunity list view or report, then identify deals that need follow-up.
Extract a Date from a Custom Date/Time field
Suppose your organization uses a custom field named Demo_Completed_At__c. It captures the exact moment when a sales representative completes a product demo.
Use this formula:
DATEVALUE(Demo_Completed_At__c)
Salesforce returns the demo completion date without the time. This helps when leadership wants to group demo completions by day or compare the date against a campaign deadline.
Pro Tip: In my experience, I create a date-only formula field only when users, reports, or automation genuinely need it. Before adding a field, check whether the report builder can group the original Date/Time field by calendar day. This keeps object layouts and field lists cleaner.
How to Create a Salesforce DATEVALUE Formula Field
A formula field is a read-only field that calculates a value whenever Salesforce displays the record. Salesforce does not store a separate value for the formula field.
Instead, it evaluates the formula from the source fields.
In this example, you will create an Opportunity formula field that shows the date when Salesforce created the opportunity.
Prerequisites
You need permission to customize the object. In most orgs, a System Administrator or an authorized user with object customization access can create fields.
You will work with the standard Opportunity object. An object is a database-style container that stores Salesforce records. Opportunities store potential revenue deals in Sales Cloud.
Step 1: Open Object Manager
- Click the Setup gear icon in Salesforce Lightning Experience.
- Select Setup.
- Open Object Manager.
- Search for and select Object.
If you are new to object configuration, review how to create a custom object in Salesforce before building formulas on your own objects.
Step 2: Create a New Formula Field
- Select Fields & Relationships from the left panel.
- Click New.
- Select Formula as the data type.
- Click Next.
- Enter Created Date Only as the field label.
- Select Date as the formula return type.
- Click Next.

Choose Date because DATEVALUE returns a Date value. Salesforce checks this return type while you build the formula.
For more details about formula-field setup, see how to create a formula field in Salesforce.
Step 3: Enter the DATEVALUE Formula
In the formula editor, enter:
DATEVALUE(CreatedDate)
Click Check Syntax. Salesforce should display a “No syntax errors” message.

This formula takes the standard CreatedDate field and returns its calendar date. It does not change the underlying Created Date value.
Step 4: Set Field Visibility
Click Next and select the profiles that should see this formula field. A profile controls a user’s baseline access to Salesforce features, objects, and fields.
You can also use a permission set, which adds permissions to selected users without changing their profile. Configure access carefully if your formula references sensitive fields.
Learn how to manage field-level security in Salesforce so the correct users can view the field.
Step 5: Add the field to the page layout
- Click Next after setting visibility.
- Select the Opportunity page layouts where users need the field.
- Click Save.
- Open an Opportunity record.
- Confirm that Salesforce displays the Created Date Only field with no time component.

You can later customize a record page with page layouts to place the field near other sales-process details.
Salesforce DATEVALUE Formula Examples
The following Salesforce DATEVALUE function examples solve common requirements that I regularly see in Sales Cloud and Service Cloud implementations.
Example 1: Check Whether a Lead Was Created Today
Create a checkbox formula field on the Lead object:
DATEVALUE(CreatedDate) = TODAY()
Set the return type to Checkbox.
Salesforce returns True when it creates the lead today and False on every other day. Sales managers can use this field in a lead list view to quickly focus on new leads.
Example 2: Calculate Days Since the Last Opportunity Update
Create a Number formula field on Opportunity with zero decimal places:
TODAY() - DATEVALUE(LastModifiedDate)
This formula helps sales managers identify neglected opportunities. For example, a value of 7 means no user has changed the opportunity in seven calendar days.
You can combine this formula with a Salesforce formula to calculate days between dates when you need more date-difference patterns.
Example 3: Flag Cases Opened Before Today
A support team handling 500 cases each month may need a fast way to find cases that remain open from earlier days.
Create a checkbox formula field on the Case object:
AND(
IsClosed = FALSE,
DATEVALUE(CreatedDate) < TODAY()
)
The formula returns True only when the case remains open and Salesforce created it before today. A service manager can use it in a Case report or list view to monitor backlog.
For a more complete support setup, see how to create a case in Salesforce and close a case in Salesforce.
Example 4: Check Whether a Demo Happened This Month
Assume an Opportunity includes a custom Date/Time field called Demo_Completed_At__c.
Create a checkbox formula field:
AND(
NOT(ISBLANK(Demo_Completed_At__c)),
MONTH(DATEVALUE(Demo_Completed_At__c)) = MONTH(TODAY()),
YEAR(DATEVALUE(Demo_Completed_At__c)) = YEAR(TODAY())
)
This formula confirms that the demo has a value and occurred during the current month and year. It avoids matching a demo from the same month in a previous year.
Read more about the Salesforce MONTH function and Salesforce YEAR function for additional formula examples.
Example 5: Use DATEVALUE with a Date/Time Formula
You can pass a Date/Time expression into DATEVALUE. For example:
DATEVALUE(NOW())
This returns today’s date according to the current user’s Salesforce time zone.
In most formulas, use TODAY() when you only need today’s date. Use DATEVALUE with NOW() when you already work with Date/Time expressions or need to keep the same formula pattern.
Learn the difference between the Salesforce NOW function and the TODAY function before choosing one.
DATEVALUE vs DATE vs DATETIMEVALUE
These functions work with date-related data, but they solve different problems.
| Function | What it does | Example |
|---|---|---|
| DATEVALUE() | Converts Date/Time into Date | DATEVALUE(CreatedDate) |
| DATE() | Builds a Date from year, month, and day numbers | DATE(2026, 8, 17) |
| DATETIMEVALUE() | Converts a text value into a Date/Time value | DATETIMEVALUE(“2026-08-17 14:30:00”) |
Use DATEVALUE when you already have a Date/Time value and need the date portion. Use DATE when you need to construct a new date. Use DATETIMEVALUE when a text value needs conversion into a Date/Time value.
For more details, read the guide to Salesforce DATETIMEVALUE formulas.
Using DATEVALUE Function in Salesforce Flow
Flow is Salesforce’s no-code automation tool. A record-triggered Flow runs automatically when a user creates or updates a record.
In many Flow scenarios, you can compare Date and Date/Time resources directly through the Flow builder. However, a Flow formula resource gives you more control when you need a date-only version of a Date/Time field.
For example, create a formula resource named CreatedDateOnly with Data Type: Date, then use:
DATEVALUE({!$Record.CreatedDate})You can use this resource in a Decision element to check whether a record was created today:
{!CreatedDateOnly} Equals {!$Flow.CurrentDate}This approach works well when you are building daily follow-up automation. For example, a record-triggered Flow can create a task after a newly created opportunity meets your qualification criteria.
Start with how to create a record-triggered Flow in Salesforce if you need help with the basic Flow setup. You can also learn how to use formulas in Salesforce Flow for more advanced automation logic.
Things to Keep in Mind
- Use Date/Time inputs: DATEVALUE expects a Date/Time value. Do not use it on a normal Date field because that field already contains only a date.
- Check time zones: Salesforce displays Date/Time fields according to each user’s time zone. A timestamp close to midnight can convert to a different calendar date for users in different time zones.
- Handle blank custom fields: Check for blank custom Date/Time fields before passing them into formulas. Use ISBLANK() when your business logic needs a clear blank-state result.
- Select the correct return type: Choose Date for a date-only formula, Number for calculations such as days elapsed, and Checkbox for true-or-false conditions.
- Keep formulas focused: Build small formulas that solve one business requirement. Complex formulas become difficult for administrators to test and maintain.
- Test with real records: Test formulas with timestamps before and after midnight, including records created by users in different time zones.
Frequently Asked Questions
What does the Salesforce DATEVALUE function do?
The Salesforce DATEVALUE function converts a Date/Time value into a Date value. It removes the time portion and returns only the calendar date.
Can I use DATEVALUE on a Date field in Salesforce?
No. A Date field already stores only a date, so DATEVALUE does not add value. Use DATEVALUE only when your source is a Date/Time field or a Date/Time expression.
How do I convert CreatedDate to a date in Salesforce?
Create a formula field with a Date return type and enter: DATEVALUE(CreatedDate)
Salesforce will display the date when it created the record without the time.
What is the difference between DATEVALUE and DATETIMEVALUE in Salesforce?
DATEVALUE converts a Date/Time value to a Date. DATETIMEVALUE converts a compatible text value to a Date/Time value. They work in opposite directions and accept different input types.
Can I use DATEVALUE in a Salesforce validation rule?
Yes. You can use DATEVALUE in a Validation Rule when you need to compare a Date/Time field with a date. For example, DATEVALUE(CreatedDate) = TODAY() checks whether Salesforce created a record today.
Does DATEVALUE account for time zones in Salesforce?
DATEVALUE evaluates a Date/Time value using the running user’s time zone. Test formulas carefully when records can be created near midnight or teams work across multiple regions.
Conclusion
The Salesforce DATEVALUE function gives you a simple way to turn Date/Time values into clean, usable date values for formulas, reporting, validation, and automation.
Start with one practical formula, test it with records in your users’ time zones, and then add more date logic only when your business process needs it.
You May Also Like
- Salesforce date formula functions
- Salesforce formula to calculate days between dates
- Salesforce formula date less than today
- How to create a Date/Time field in Salesforce
- How to use the Salesforce WEEKDAY formula

Tanya is a Salesforce consultant working in a reputed organization and holds expertise in both Salesforce administration and development. She has experience in Salesforce integration, reports, dashboards, automation data analytics, etc., and trained hundreds of Salesforce enthusiasts and delivered various Salesforce projects and solutions. Read more | LinkedIn Profile