function CheckDateFormat(SDate:string):string;
var
IDate
Char:string;
x,y:integer;
begin
IDate
Char:='.,/';
for y:=1 to length(IDate
Char) do
begin
x:=pos(IDate
Char[y],SDate);
while x>0 do
begin
Delete(SDate,x,1);
('-',SDate,x);
x:=pos(IDate
Char[y],SDate);
end;
end;
CheckDateFormat:=SDate;
end;
function DateEncode(SDate:string):longint;
var
year,month,day:longint;
wy,wm,wd:longint;
Dummy:TDateTime;
Check:integer;
begin
DateEncode:=-1;
SDate:=CheckDateFormat(SDate);
Val(Copy(SDate,1,pos('-',SDate)-1),day,check);
Delete(Sdate,1,pos('-',SDate));
Val(Copy(SDate,1,pos('-',SDate)-1),month,check);
Delete(SDate,1,pos('-',SDate));
Val(SDate,year,check);
wy:=year;
wm:=month;
wd:=day;
try
Dummy:=EncodeDate(wy,wm,wd);
except
year:=0;
month:=0;
day:=0;
end;
DateEncode:=(year
000)+(month
0)+day;
end;