Converts a string into a Date data type in Salesforce Spiff. This function finds the date value for a field that isn't specifically a Date data type so that Spiff can use the date value in calculations and other functions related to dates.
Required Editions
| Available in: both Salesforce Classic (not available in all orgs) and Lightning
Experience |
| Available in: Enterprise, Unlimited, and Developer
Editions |
| Available for an additional cost in: Professional Edition with Web
Services API Enabled |
Arguments
| Argument |
Required? |
Description |
| string |
Required |
A string representation of a date in the YYYY-MM-DD format, enclosed in double quotes. For a summary calculation, manually enter a date or reference a field that contains date values. |
Considerations
If you have a date field but Spiff interprets the field's data type as a String, change the data type of the field directly to Date instead of using the date() function.
Example
Indicate that plan assignment custom field, named RampStartDate, is a date.
=date(plan_assignment.RampStartDate)
Create a data filter that returns only deals with close dates after January 1, 2025, and convert the hard-coded date in text format to a date value.
CloseDate > date("2025-01-01")
Convert the CreatedDate time stamp, which is a Date & Time value, to only a Date value.
=date(CreatedDate)