码迷,mamicode.com
首页 > Windows程序 > 详细

delphi日期GMT格式

时间:2019-06-19 17:14:05      阅读:152      评论:0      收藏:0      [点我收藏+]

标签:string   mat   UNC   decode   result   date   format   datetime   %s   

function TForm1.DateTimeToGMT(const DateTime: 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(DateTime, wYear, wMonth, wDay, wHour, wMin, wSec, wMilliSec);
wWeek := DayOfWeek(DateTime);
sWeek := WEEK[wWeek];
sMonth := MonthDig[wMonth];
Result := Format(‘%s, %.2d %s %d %.2d:%.2d:%.2d GMT‘, [sWeek, wDay, sMonth, wYear, wHour, wMin, wSec]);
end;

delphi日期GMT格式

标签:string   mat   UNC   decode   result   date   format   datetime   %s   

原文地址:https://www.cnblogs.com/zyb2016/p/11051932.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!