RSS订阅 | 匿名投稿
您的位置:网站首页 > 时间 > 正文

delphi DateTimeToGMT GMT时间与TDateTime转换

作者:admin 来源: 日期:2018/1/7 15:20:40 人气: 标签:

uses  
  DateUtils,;  
  
function DateTimeToGMT(const ADate:TDateTime):string;  
const  
  WEEK:array[1..7] of PChar = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');  
  MonthDig:array[1..12] of PChar =  
    ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');  
var  
  wWeek,wYear,wMonth,wDay,wHour,wMin,wSec,wMilliSec:Word;  
  sWeek,sMonth:string;  
begin  
  DecodeDateTime(ADate,wYear,wMonth,wDay,wHour,wMin,wSec,wMilliSec);  
  wWeek := DayOfWeek(ADate);  
  sWeek  := WEEK[wWeek];  
  sMonth := MonthDig[wMonth];  
  Result := Format('%s, %.2d %s %d %.2d:%.2d:%.2d GMT',[sWeek,wDay,sMonth,wYear,wHour,wMin,wSec]);  
end;  

//sDate:='Sat, 02 Sep 2017 03:08:12 GMT';  
  sDate:=DateTimeToGMT(TTimeZone.Local.ToUniversalTime(now())); 

读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址:
下一篇:没有资料