Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: ThomasTThis is very messy so I guess the Lavastorm guys have a better solution, but this should work
#corrects the year to 4 digits
if Closing_Date.right(4).left(2) == "20" then P = Closing_Date else if
Closing_Date.right(3).left(1) == "-" then P = Closing_Date.left(Closing_Date.len()-3)+"-20"+Closing_Date.right(2) else
P = Closing_Date.left(Closing_Date.len()-4)+"-20"+right(Closing_Date,2)
#replaces the letters to the corresponding month
if P.strFind("JAN") > -1 then X = P.replace("JAN","1") else if
P.strFind("FEB") > -1 then X = P.replace("FEB","2") else if
P.strFind("MAR") > -1 then X = P.replace("MAR","3") else if
P.strFind("APR") > -1 then X = P.replace("APR","4") else if
P.strFind("MAY") > -1 then X = P.replace("MAY","5") else if
P.strFind("JUN") > -1 then X = P.replace("JUN","6") else if
P.strFind("JUL") > -1 then X = P.replace("JUL","7") else if
P.strFind("AUG") > -1 then X = P.replace("AUG","8") else if
P.strFind("SEP") > -1 then X = P.replace("SEP","9") else if
P.strFind("OCT") > -1 then X = P.replace("OCT","10") else if
P.strFind("NOV") > -1 then X = P.replace("NOV","11") else if
P.strFind("DEC") > -1 then X = P.replace("DEC","12") else
X = P
#convert do date depending on the format
if X.strFind("/") > -1 then Newdate = date(X,"M/D/CCYY") else Newdate = date(X,"D-M-CCYY")
#emit new field
emit * override emit Newdate as "Closing_Date"