createTimeZoneByNameWindows

createTimeZoneByNameWindows(timeZoneName: String}: JadeTimeZone typeMethod;

The createTimeZoneByNameWindows method of the JadeTimeZone class takes the name (in Windows format) of the time zone specified in the timeZoneName parameter to represent the name of a time zone within the Windows registry and returns a JadeTimeZone object with properties that match that time zone.

Any JadeTimeZone objects created with the createTimeZoneByNameWindows method have an ianaName property value of "" (an empty string). It is not possible to determine an equivalent IANA time zone for a time zone created with a Windows time zone name because Windows to IANA time zones have a one‑to‑many relationship.

For a complete list of the time zones in the Windows registry, see device\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones, where the key directly under the above path is the time zone name used as the timeZoneName parameter value. For example, specifying "Afghanistan Standard Time" as the timeZoneName parameter value creates a JadeTimeZone object using the data found at device\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Afghanistan Standard Time.

To ensure that time zone information is consistent between different nodes, which can be running on different versions and update levels of Windows and therefore may have different time zone information in their registries, time zone information is always taken from the registry of the device that is running the database server or single‑user node.

If the time zone name specified in the timeZoneName parameter does not match a time zone specified in the Windows registry, exception 1469 (Time zone not found) is raised.

The following example shows the use of the createTimeZoneByNameWindows method that converts time between Western European Time and Eastern Standard Time when the clock strikes 12.

example_createTimeZoneByNameWindows();
vars
    wEuropeanDate: Date;
    wEuropeanTime: Time;
    wEuropeanTimeStamp: TimeStamp;
    wEuropeanTimeZone: JadeTimeZone;
    eStandardTimeStamp: TimeStamp;
    eStandardTimeZone: JadeTimeZone;
begin
    wEuropeanTime.setTime(0,0,0,0); 
        // Set the Western European timestamp to midnight
    wEuropeanDate.setDate(1,1,2020); 
        // Set the Western European timestamp to the 1st of January 2020
    wEuropeanTimeStamp.setTime(wEuropeanTime);
    wEuropeanTimeStamp.setDate(wEuropeanDate);
    wEuropeanTimeZone := JadeTimeZone@createTimeZoneByNameWindows("W.
        Europe Standard Time"); 
        // Create a JadeTimeZone for Western European, using the Windows name
    eStandardTimeZone := JadeTimeZone@createTimeZoneByNameWindows("Eastern 
        Standard Time"); 
        // Create a JadeTimeZone for Eastern Standard, using the Windows name
    eStandardTimeStamp := wEuropeanTimeZone.convertTimeByTimeZone
        (wEuropeanTimeStamp, eStandardTimeZone); 
        // Convert the time from Western European to Eastern Standard
    write "The time in Eastern Standard when the clock strikes twelve in 
        Western Europe is " & eStandardTimeStamp.String;
epilog
    delete wEuropeanTimeZone;
    delete eStandardTimeZone;
end;

2020.0.01 and higher