* Function Char2Date LPARAMETERS ; tcDateTime LOCAL ; lcMonth, ; lcDayNumber, ; lcMonthNumber, ; lcYearNumber * Need to parse the string and convert character month to numeric: lcMonth = UPPER(SUBSTR(tcDateTime, 1, 3)) DO CASE CASE lcMonth = "JAN" lcMonthNumber = "01" CASE lcMonth = "FEB" lcMonthNumber = "02" CASE lcMonth = "MAR" lcMonthNumber = "03" CASE lcMonth = "APR" lcMonthNumber = "04" CASE lcMonth = "MAY" lcMonthNumber = "05" CASE lcMonth = "JUN" lcMonthNumber = "06" CASE lcMonth = "JUL" lcMonthNumber = "07" CASE lcMonth = "AUG" lcMonthNumber = "08" CASE lcMonth = "SEP" lcMonthNumber = "09" CASE lcMonth = "OCT" lcMonthNumber = "10" CASE lcMonth = "NOV" lcMonthNumber = "11" CASE lcMonth = "DEC" lcMonthNumber = "12" ENDCASE * Assume current year: lcYearNumber = LTRIM(STR(YEAR(DATE()))) * Extract day: * This is tricky if the return value has only a single digit for day # less than 10: * To handle this, we'll always take the 5th and 6th characters. If the 6th is a space, * the TRIM() will get rid of it. * We also want values < 10 to be left padded with a zero: lcDayNumber = PADL(TRIM(SUBSTR(tcDateTime, 5, 2)), 2, "0") * Create and evaluate unambiguous date as the return value: RETURN EVALUATE("{^" + lcYearNumber + "-" + lcMonthNumber + "-" + lcDayNumber + "}")