I am trying to create a formula in my custom report to show number of days between
CUSTOM_FIELD (datetime field) and
How can I do this?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
If you are only interested in the number of days and not the number of hours, you could also use
TODAY() - DATEVALUE(Custom_Field__c)
TODAY() and NOW()
The TODAY() function returns the current day, month, and year as a Date data type. This function is useful for formulas where you are concerned with how many days have passed since a previous date, the date of a certain number of days in the future, or if you just want to display the current date. The NOW() function returns the Date/Time value of the current moment. It’s useful when you are concerned with specific times of day as well as the date. For details on how to convert between Date values and Date/Time values, see Converting Between Date/Time and Date.
Converting Between Date/Time and Date
Date and Date/Time aren’t interchangeable data types, so when you want to perform operations between Date and Date/Time values, you need to convert the values so they are both the same type. Some functions (such as YEAR(), MONTH(), and DAY()) also only work on Date values, so Date/Time values must be converted first. Use the DATEVALUE( date/time ) function to return the Date value of a Date/Time. For example, to get the year from a Date/Time, use YEAR( DATEVALUE( date/time ) ) ).