Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: mwillettHi there,
I have data with dates structured as follows "01 January, 2011". The day part is always the first two characters and the year part is always the last four. I can convert these to a date format with the node below but is there a better way (to handle a full named month including the trailing comma)?
Regards,
Mike
node:Filter
bretype:core::Filter
editor:sortkey=4fa8999b2cbc352d
input:@40fd2c74167f1ca2/=Donor_Events.41e6c6cd11e613c6
output:@40fd2c7420761db6/=
prop:Script=<<EOX
CalendarDay = left(CAL_DATE, 2)
CalendarMonth = regexSubstituteI(CAL_DATE, "[^A-Za-z]", "")
CalendarYear = right(CAL_DATE, 4)
if CalendarMonth == "January" then CalMonth = "01"
else if CalendarMonth == "February" then CalMonth = "02"
else if CalendarMonth == "March" then CalMonth = "03"
else if CalendarMonth == "April" then CalMonth = "04"
else if CalendarMonth == "May" then CalMonth = "05"
else if CalendarMonth == "June" then CalMonth = "06"
else if CalendarMonth == "July" then CalMonth = "07"
else if CalendarMonth == "August" then CalMonth = "08"
else if CalendarMonth == "September" then CalMonth = "09"
else if CalendarMonth == "October" then CalMonth = "10"
else if CalendarMonth == "November" then CalMonth = "11"
else if CalendarMonth == "December" then CalMonth = "12"
NewCalDate = date(strcat(CalendarDay, CalMonth, CalendarYear), "DDMMCCYY")
emit CAL_DATE, CalendarDay, CalendarMonth, CalMonth, CalendarYear, NewCalDate
EOX
editor:XY=390,240
end:Filter