private function CFomart(byval SString as string) as string
if not isdate(sstring) then CFmorat="Error Input":exit function
cfmorat=cstr(year(sstring))&CDuboleS(month(sstring))&CDoubleS(day(sstring))
end function
private function CDuboleS(byval SString as string) as string
CDouboleS=iif(len(sstring)=1,"0"&sstring,sstring)
end function
usage:CFormat("2006-1-5")