Get tips on using Date and Date/Time formula fields. Learn how to convert between date
and date/time and work with time zones. Plus, find guidance on calculating durations and
intervals, and handling fractional values in date calculations.
Required Editions
Available in: both Salesforce Classic and Lightning Experience
Available in: All Editions
Dates and times are always calculated using the user’s time zone.
Date and date/time fields can’t be used interchangeably. The name alone may not indicate if
a field is a date or date/time. For example, Created Date and Last Modified Date are date/time
fields whereas Last Activity Date is a date field. Use the DATEVALUE function to convert a
date/time field into a date field.
Note The Created Date and Last Modified Date fields display
only the date, not the date and time.
Use addition and subtraction operators with date or date/time fields to calculate duration.
For example, subtract a date from another date to calculate the number of days between the two.
Likewise, you can subtract the date/time from another date/time to get the number of days
between the two as a number. See NOW or TODAY for suggested use.
Use addition and subtraction operators with numbers to return another date or date/time. For
example, {!CreatedDate} + 5 calculates the date and time
five days after a record’s created date. Note that the expression returns the same data type as
the one given; a date field plus or minus a number returns a date, and a date/time field plus
or minus a number returns a date/time.
When calculating dates using fractions, Salesforce ignores any numbers beyond the decimal.
For example:
TODAY() + 0.7 is the same as TODAY() + 0, which is today’s date.
TODAY() + 1.7 is the same asTODAY() + 1, which is tomorrow’s date.
TODAY() + (-1.8) is the same as TODAY() +
(-1), which is yesterday’s date.
To calculate the value of two fractions first, group them within parentheses. For
example:
TODAY() + 0.5 + 0.5 is the same as TODAY() + 0 + 0, which is today’s date.
TODAY() + (0.5+0.5) is the same as TODAY() + 1, which is tomorrow’s date.
Years can’t be zero and must be between -4713 and 9999.
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.