I’m trying to use executeScript_Sandbox to convert a date format but the variable is not getting defined in UI.Vison. I’m wondering what I’m doing wrong.
{
“Name”: “change date”,
“CreationDate”: “2024-9-22”,
“Commands”: [
{
“Command”: “store”,
“Target”: “November 21, 2018”,
“Value”: “inputDate”,
“Description”: “”
},
{
“Command”: “executeScript_Sandbox”,
“Target”: “(function() { var inputDate = ‘${inputDate}’;\n var dateParts = inputDate.split(’ ‘); var year = dateParts[2].slice(-2);\n var monthNames = [‘January’,‘February’,‘March’,‘April’,‘May’,‘June’,‘July’,‘August’,‘September’,‘October’,‘November’,‘December’]; var month = (monthNames.indexOf(dateParts[0]) + 1);\n if (month < 10) { month = ‘0’ + month; } var day = dateParts[1].replace(’,', ‘’);\n if (day.length < 2) { day = ‘0’ + day; } \n return year + ‘.’ + month + ‘.’ + day; })();”,
“Value”: “formattedDate”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${formattedDate} - formated date”,
“Value”: “”,
“Description”: “dd”
}
]
}
Hello Plankton, thank you for your assistance. it is just a code snippet I’ve created for proof of concept or a bit of practice before implementation of a solution.
In this snippet I’m converting a date in the format “November 21, 2018” to the format 21.11.08" and placing the result in a variable for use elsewhere in a Macro that hasn’t been constructed yet.