标签: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;
标签:string mat UNC decode result date format datetime %s
原文地址:https://www.cnblogs.com/zyb2016/p/11051932.html