在处理HTTP头的时候需要把请求到的哥里尼制时间转换为本地时间.
function Tupdate_form_main.getlocaltime(headtime: string): Tdatetime;
var
headt:Tstrings;
tim:string;
z:_TIME_ZONE_INFORMATION;
begin
GetTimeZoneInformation(z);
headt:=Tstringlist.Create;
headt.Text:=headtime;
headt.Text:=formt(' ',#13#10,headt.Text);
tim:='';
tim:=tim+headt.Strings[3];
tim:=tim+'-';
if lowercase(headt.Strings[2])='jan' then
tim:=tim+'1'
else if lowercase(headt.Strings[2])='feb' then
tim:=tim+'2'
else if lowercase(headt.Strings[2])='mar' then
tim:=tim+'3'
else if lowercase(headt.Strings[2])='apr' then
tim:=tim+'4'
else if lowercase(headt.Strings[2])='may' then
tim:=tim+'5'
else if lowercase(headt.Strings[2])='jun' then
tim:=tim+'6'
else if lowercase(headt.Strings[2])='jul' then
tim:=tim+'7'
else if lowercase(headt.Strings[2])='aug' then
tim:=tim+'8'
else if lowercase(headt.Strings[2])='sep' then
tim:=tim+'9'
else if lowercase(headt.Strings[2])='oct' then
tim:=tim+'10'
else if lowercase(headt.Strings[2])='nov' then
tim:=tim+'11'
else if lowercase(headt.Strings[2])='dec' then
tim:=tim+'12';
tim:=tim+'-'+headt.Strings[1];
tim:=tim+' '+headt.Strings[4];
result:=IncMinute(strtodatetime(tim),z.Bias*(-1));
headt.Free;
end;
function Tupdate_form_main.formt(su, st, s: string): string;
begin
while pos(su,s)<>0 do
begin
s:=copy(s,0,pos(su,s)-1)+st+copy(s,pos(su,s)+length(su),length(s)-pos(su,s));
end;
formt:=s;
end;