function CheckDate
Format(SDate:string):string;
var
IDateChar:string;
x,y:integer;
begin
IDateChar:='.,/';
for y:=1 to length(IDateChar) do
begin
x:=pos(IDateChar[y],SDate);
while x>0 do
begin
Delete(SDate,x,1);
('-',SDate,x);
x:=pos(IDateChar[y],SDate);
end;
end;
CheckDate
Format:=SDate;
end;
function DateEncode(SDate:string):longint;
var
year,month,day:longint;
wy,wm,wd:longint;
Dummy:TDateTime;
Check:integer;
begin
DateEncode:=-1;
SDate:=CheckDate
Format(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;