Local Time / Server Time / What Time Zones

If you don’t mind a little poking around in the Registry, you can ‘roll your own’ time-zone stuff:


// ------------------------------------------- // ref: http://support.microsoft.com/kb/221542 // ------------------------------------------- CREATE(wshShell); // get 'active' time bias... intActiveTimeBias := wshShell.RegRead( 'HKLM\System\CurrentControlSet\Control\TimeZoneInformation\ActiveTimeBias'); // get base bias... intBias := wshShell.RegRead( 'HKLM\System\CurrentControlSet\Control\TimeZoneInformation\Bias'); // get standard bias and name... intStandardBias := wshShell.RegRead( 'HKLM\System\CurrentControlSet\Control\TimeZoneInformation\StandardBias'); txtStandardName := wshShell.RegRead( 'HKLM\System\CurrentControlSet\Control\TimeZoneInformation\StandardName'); // get daylight bias and name... intDaylightBias := wshShell.RegRead( 'HKLM\System\CurrentControlSet\Control\TimeZoneInformation\DaylightBias'); txtDaylightName := wshShell.RegRead( 'HKLM\System\CurrentControlSet\Control\TimeZoneInformation\DaylightName'); CASE intActiveTimeBias OF intBias + intStandardBias: txtCurrTimeZone := txtStandardName; intBias + intDaylightBias: txtCurrTimeZone := txtDaylightName; ELSE txtCurrTimeZone := '(?)'; END; timLocalTime := TIME; timUTCTime := timLocalTime + (intActiveTimeBias * 60000); timPacificTime := timUTCTime - (8 * 60 * 60 * 10000); MESSAGE( 'Your machine''s current time zone is ''%1''.\\' + 'The local machine time is %2.\\' + 'If this is reasonably correct, then:\\' + ' - UTC time is %3, and\\' + ' - Pacific time is %4.', txtCurrTimeZone, timLocalTime, timUTCTime, timPacificTime); CLEAR(wshShell);