delphi DateTimeToGMT GMT时间与TDateTime转换


本文整理自网络,侵删。

 
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())); 

相关阅读 >>

Delphi hextoint

Delphi firedac,ado性能测试

Delphi 三层架构简单例子(经测试成功)

Delphi isleapyear、isinleapyear - 是否是闰年

Delphi int64 与 currency

Delphi 安卓开发 ioutils文件说明

Delphi xe intraweb 程序在iis下的发布详细教程

Delphi 取得dll所在目录

Delphi中如何向某个ip不间断的发送数据

fmsoft_unigui个文件说明

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    暂无评论...