Try:
if len({table.date}) = 8 then
cdate(left({table.date},4),mid({table.date},5,2),mid({table.date},7,2))
else
cdate(0,0,0)
Note that any calculations/aggregates against this formula would then verify that the @dateformula <> cdate(0,0,0) as this identifies an invalid date.
-k