I have an iMacros script working with data extracted from csv file. I am trying to change a format date different as is extracted from my csv file. I need 08-24-2022 to be replaced with Aug 24, 2022 basically d-mmm-yy with mmm d, yyyy
I tried something like this,, don't know how to make it work, Thank you for support!
SET date "08-24-2022"
SET dateFormatted EVAL("\"{{date}}\".replace(/(\\d{4})-(\\d\\d)-(\\d\\d)/, \"$2 $3, $1\");")
PROMPT {{dateFormatted}}
I am using: Browser: Google Chrome Version 105.0.5195.102 (Official Build) (64-bit)
iMacros Personal Edition License - Addon for Chrome -Version 10.1.1
Windows 10 (64-bit)
One "easy" Implementation: Declare the Months yourself in a Var/Array and use the Month Number as Index (to re-split()
the Array into the 12 Months) to convert it to the mmm
Format, stg like:
VERSION BUILD=8820413 RECORDER=FX
TAB T=1
SET date "08-24-2022"
'SET dateFormatted EVAL("\"{{date}}\".replace(/(\\d{4})-(\\d\\d)-(\\d\\d)/, \"$2 $3, $1\");")
SET Months _Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec_
SET dateFormatted EVAL("var d='{{date}}', m='{{Months}}', x,y,z; x=d.split('-'); y=m.split('_')[x[0]*1]; z=y+' '+x[1]+', '+x[2]; z;")
PROMPT _{{dateFormatted}}_
For Date="08-24-2022", this will output Aug 24, 2022
.
For Date="08-04-2022", this will output Aug 04, 2022
.
(=> Use x[1]*1
instead of x[1]
in z
if you would prefer Aug 4, 2022
for 1-Digit Dates from 01
-09
to remove the Leading 0...)
(Written and tested in iMacros for FF v8.8.2, PM v26.3.3, Win10_PRO_21H2
.)