const<br> MinsPerDay = 24 * 60;<br><br>function GetGMTBias: Integer;<br>var<br> info: TTimeZoneInformation;<br> Mode: DWord;<br>begin<br> Mode := GetTimeZoneInformation(info);<br> Result := info.Bias;<br> case Mode of<br> TIME_ZONE_ID_INVALID: RaiseLastOSError;<br> TIME_ZONE_ID_STANDARD: Result := Result + info.StandardBias;<br> TIME_ZONE_ID_DAYLIGHT: Result := Result + info.DaylightBias;<br> end;<br>end;<br><br>function LocaleToGMT(const Value: TDateTime): TDateTime;<br>{<br> 把本地时间Value转换成GMT/UTC时间<br>}<br>begin<br> Result := Value + (GetGMTBias / MinsPerDay);<br>end;<br><br>function GMTToLocale(const Value: TDateTime): TDateTime;<br>{<br> 把GMT/UTC时间Value转换成本地时间<br>}<br>begin<br> Result := Value - (GetGMTBias / MinsPerDay);<br>end;<br>