RFC822DateGMT

function RFC822DateGMT(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
  dg:TDateTime;
  y,m,d,wd,th,tm,ts,tms:Word;
  tz:TIME_ZONE_INFORMATION;
begin
  GetTimeZoneInformation(tz);
  dg:=dd+tz.Bias/1440;
  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

时间: 2024-10-01 04:21:49

RFC822DateGMT的相关文章