delphi日期GMT格式
Posted zyb2016
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了delphi日期GMT格式相关的知识,希望对你有一定的参考价值。
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格式的主要内容,如果未能解决你的问题,请参考以下文章
Delphi获取与设置系统时间格式,即GetLocaleInfo和SetLocaleInfo
Delphi Xe 中如何把日期格式统一处理,玩转 TDatetime