1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
function DateTimeToGmtOffSetStr(ADateTime: TDateTime; SubGMT: Boolean): string;
var
AHour, AMin, ASec, AMSec: Word;
{$IFDEF FPC}
Absint : longint ;
{$ENDIF}
begin
if (ADateTime = 0.0) and SubGMT then
begin
Result := 'GMT'; {do not localize}
Exit;
end;
{$IFDEF WIN32_OR_WIN64_OR_WINCE}
DecodeTime(ADateTime, AHour, AMin, ASec, AMSec);
Result := IndyFormat(' %0.2d%0.2d', [AHour, AMin]); {do not localize}
if ADateTime < 0.0 then begin
Result[1] := '-'; {do not localize}
end else begin
Result[1] := '+'; {do not localize}
end;
{$ELSE}
{$IFDEF FPC}
// concerne Freepascal
AbsInt := ABS(Tzseconds);
AHour := AbsInt DIV 3600;
AMin := (AbsInt MOD 3600) DIV 60;
Result := IndyFormat(' %0.2d%0.2d', [AHour, AMin]);
if Tzseconds < 0.0 then begin
Result[1] := '-'; {do not localize}
end else begin
Result[1] := '+'; {do not localize}
end;
{$ENDIF}
{$ENDIF}
end; |
Partager