About this article
This article explains what the DateValue() function is and provide examples of how it can be used with the binding syntax in smart templates.
Prerequisites
|
What is the DateValue() function?
DateValue() is a function used for converting plain text dates into a date object for use in other date functions such as FormatDateTime(). This function is often used for taking dates from external systems such as Salesforce and making them usable with date functions in Templafy.
DateValue() logic
Syntax | {{DateValue(DateTime,Format,Region)}} |
Input | Text |
Output | Date value as date type that is regionalized and formatted |
DateValue() function examples
Example 1
Using DateValue() to create a date object out of text, format and region.
Binding | {{DateValue("2020/10/22","yyyy/MM/dd","en-US")}} |
Input | 2020-10-22 (As a date object) |
|
Example 2
Using DateValue() to create a date object out of text, format and region.
Binding | {{DateValue("Oct 22th, 2020","MMM d'th,' yyyy","en-US")}} |
Input | 2020-10-22 (As a date object) |
Example 3
Using DateValue() in combination with HostSystem to transform a date in text originating from an external system, and convert it to a date object.
Binding | {{DateValue(HostSystem.Date,"MMM d'th,' yyyy","en-US")}} |
Input | "Oct 11th, 2020" |
Output | 2020-10-11 (As a date object) |
Related articles
Comments
0 comments
Article is closed for comments.