Translate date formats

   Exchange Pre-configured Maestro services.  |   Platform Developer |  All versions   This feature is related to v5.1 and higher.

The native date format used in Temenos Journey Manager is yyyy-MM-dd. This format is used by the forms so all dates coming from forms in either dynamic data calls or submission XML payloads will be in this format.

If a third-party service requires a different date format, you must reformat the date as required. It may help to write your own helper function to do this.

For example:

/**
* Formats an Avoka standard date format string (yyyy-MM-dd) to a greenId format date (dd/MM/yyyy)
*
* @param avokaDateString The Avoka standard date format (yyyy-MM-dd) as a string
* @return the greenId formatted date as string
*/
static String formatDate(avokaDateString){
    if(!avokaDateString){
        return ''
    }
    def avokaDate = Date.parse('yyyy-MM-dd', avokaDateString)
    def formattedDateString = avokaDate.format('dd/MM/yyyy')
    logger.debug 'Date format conversion from ' + avokaDateString + ' to ' + formattedDateString
    return formattedDateString
}