尝试使用TZDB ...如何在delphi 7中进行转换

时间:2012-08-16 04:29:50

标签: delphi delphi-7

如何在delphi7中转换此代码...

 procedure Tform1.button1.click(sender: tobject);  
 var
   LTZID: string;
 begin
  // Write each time zone ID on the console 
  for LTZID in TBundledTimeZone.KnownTimeZones(true) do
  WriteLn(LTZID);
end;

谢谢...

1 个答案:

答案 0 :(得分:4)

procedure Tform1.button1.click(sender: tobject);
 var
   i: Integer;
 begin
  // Write each time zone ID on the console
  for i := Low(TBundledTimeZone.KnownTimeZones(true))
      to High(TBundledTimeZone.KnownTimeZones(true)) do
    WriteLn(TBundledTimeZone.KnownTimeZones(true)[i]);
end;

或者,有点优化:

procedure Tform1.button1.click(sender: tobject);
 var
   KnownTimeZones: TStringDynArray;
   i: Integer;
 begin
  // Write each time zone ID on the console
  KnownTimeZones := TBundledTimeZone.KnownTimeZones(true);
  for i := Low(KnownTimeZones) to High(KnownTimeZones) do
    WriteLn(KnownTimeZones[i]);
end;