Get a DateTime in RFC822 format
2007-08-10 23:54 i1255 [permalink]
RFC822 defines the header-format used in e-mails (SMTP/POP3/IMAP) and HTTP
function RFC822Date(dd: TDateTime): string;
const
Days:array [1..7] of string=
('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
Months:array [1..12] of string=
('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
SignStr:array[boolean] of string=('-','+');
var
y,m,d,wd,th,tm,ts,tms:Word;
tz:TIME_ZONE_INFORMATION;
begin
DecodeDateFully(dd,y,m,d,wd);
DecodeTime(dd,th,tm,ts,tms);
GetTimeZoneInformation(tz);
FmtStr(Result, '%s, %d %s %d %.2d:%.2d:%.2d %s%.2d%.2d', [
Days[wd],d,Months[m],y,th,tm,ts,
SignStr[tz.Bias<0],abs(tz.Bias div 60),abs(tz.Bias mod 60)]);
end;