RFC822DateGMT

时间:2023-03-08 16:48:46
function RFC822DateGMT(dd: TDateTime): string;
const
Days:array [..] of string=
('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
Months:array [..] of string=
('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
// SignStr:array[boolean] of string=('-','+');
var
dg:TDateTime;
y,m,d,wd,th,tm,ts,tms:Word;
tz:TIME_ZONE_INFORMATION;
begin
GetTimeZoneInformation(tz);
dg:=dd+tz.Bias/;
DecodeDateFully(dg,y,m,d,wd);
DecodeTime(dg,th,tm,ts,tms);
FmtStr(Result, '%s, %d %s %d %.2d:%.2d:%.2d GMT',
[Days[wd],d,Months[m],y,th,tm,ts]);
end;

本文转自:

http://sourceforge.net/p/xxm/code/HEAD/tree/trunk/Delphi/common/xxmCommonUtils.pas