function Str2Date lparameters tcStr local ldRetVal, lcFormatStr if chrtran(tcStr,'/-.','')==tcStr && No date separators if !inlist(len(tcStr),8,6) && Else too much ambigious return {} endif lcFormatStr = padl('99/99/99',len(tcStr)+2,'9') ldRetVal = ctod(transform(tcStr,'@R ^'+lcFormatStr)) && Try strict first if empty(ldRetVal) && Try putting separators ldRetVal = Str2Ctod(transform(tcStr,'@R '+lcFormatStr)) if empty(ldRetVal) ldRetVal = Str2Ctod(transform(tcStr,'@R '+; padr('99/99/99',len(tcStr)+2,'9'))) endif endif else ldRetVal = Str2Ctod(tcStr) endif return ldRetVal function Str2Ctod lparameters tcStr local lcDateSet, ldRetVal if !empty(ctod(tcStr)) return ctod(tcStr) endif lcDateSet = set('date') set date mdy && For US this one is first to try ldRetVal = ctod(tcStr) if empty(ldRetVal) set date dmy ldRetVal = ctod(tcStr) if empty(ldRetVal) set date ymd ldRetVal = ctod(tcStr) endif endif set date to &lcDateSet return ldRetValCetin