Hi,
How do I display a date column in a Designer detail table in the format dd-mm-yyyy?
Hi,
How do I display a date column in a Designer detail table in the format dd-mm-yyyy?
Hi B,
Can you confirm how the date field is currently formatted in the data mapper? In addition, can you also confirm whether this field is of the type String or of the type Date in the data mapper?
Regards,
Rod
Hi Rod,
The date is type ‘Date’, in the format ‘yyyy-mm-dd’
Hi B,
First I would keep the date field as a string in the data mapper.
Then I would configure the date field so that it is based on JavaScript instead of the location. See below screenshot
Finally, I would use the split() method on the string to then re-format the date. Please note that the JavaScript split() method will return a 0 based array of values.
var tempDate =data.extract(‘./Start_Date’);
tempDate.split(‘-’)[2] + ‘-’ + tempDate.split(‘-’)[1] + ‘-’ + tempDate.split(‘-’)[0];
Regards,
Rod
For performance purposes, I have slightly modified the script so that it splits the date field once and store it in the array tempDate and then simply gets each part of the array that is stored in memory once:
var tempDate =(data.extract(‘./Start_Date’)).split(‘-’);
tempDate[2] + ‘-’ + tempDate[1] + ‘-’ + tempDate[0];
Allowing users to specify any custom date format in the text script wizard is one of the new features in Connect 1.4.
In Connect 1.3 you could consider setting the locale (Edit > Locale) to da-DK and specifying Default Date in the Format column of the text script wizard. This should work since dd-mm-yyyy happens to be the default Danish date format. Not an ideal solution of course, but it might be preferable to pre-formatting the field in the data mapper.
Hi
I would map the date field in data mapper as a date field, just match the format when creating the extraction:
…and then use the built in format options in Designer: