[5.45] Format date in output CSV
TerminéeIntroduced in VertiGIS Studio Workflow 5.45
I'm trying to using toLocaleDateString to format a date field that's being included in a CSV export workflow. Here's the line in my workflow's Evaluate Expression activity that is formatting my date field:
new Date($forEach.item.attributes.LastEditedDate).toLocaleDateString('en-US')
A sample of the output it provides is Wednesday, August 28, 2024. Instead in this case I'd want it to output 8/28/2024.
Any ideas on how to format the output of a date field?
-
Hi John Nerge ,
There is a new enhancement coming in Workflow 5.45 (next week, all being well!) that will allow you to supply a custom format string to the Format Date activity. Based on your example, the format string “M/d/yyyy” would produce the desired output.
In the meantime, the alternative approach would be to use the getMonth(), getDate() and getFullYear() methods of Date. Since it looks like you don't want to pad the day or month with leading zeroes, you might just be able to do this:
=`${$myDate.result.getMonth() + 1}/${myDate.result.getDate()}/${myDate.result.getFullYear()}`Be careful of the month in particular the value is 0-11, not 1-12 as you might expect.
0
Vous devez vous connecter pour laisser un commentaire.
Commentaires
1 commentaire