FAQ: How can I convert a date in the format 17-Mar-2018 (DD-MMM-YYYY)?

Q. In NetSuite, we’re using the date format DD-Mon-YYYY, such as 17-Mar-2018. When this field is written to Salesforce, the flow successfully adds or updates the record, but the date field in Salesforce keeps defaulting the month to 1, instead of 3 as intended. Is there an expression I can apply when mapping the NetSuite value to Salesforce?

A. First, Salesforce expects the date value in the format YYYY-MM-DD.

The second thing to know is that the correct handlebars format for 17-Mar-2018 is DD-MMM-YYYY.

Putting those together, we can call {{dateFormat}} to handle the conversion automatically. Given a source date field of dateEntered, then the following handlebars statement:

{{dateFormat "YYYY-MM-DD" dateEntered "DD-MMM-YYYY"}}

...will convert the NetSuite date to the expected 2018-03-17.