createTimeZoneByLocationWindows
createTimeZoneByLocationWindows(location: Integer}: JadeTimeZone typeMethod;
The createTimeZoneByLocationWindows method of the JadeTimeZone class returns a JadeTimeZone object that matches the local time zone defined in the Windows registry of the location specified in the location parameter.
The location parameter values are provided by the global constants in the
Global Constant | Integer Value | Method is executed... |
---|---|---|
DatabaseServer | 1 | On the database server node |
PresentationClient | 2 | On the presentation client (applicable to applications running in thin client mode) |
CurrentLocation | 0 | The database server node or presentation client, depending on whether the method is executed on a presentation client node or the database server |
The full list of time zones available in the registry on a device can be found at:
device\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones
An up‑to‑date list of time zones maintained by Windows can be found at:
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones
If the local time zone of the specified location does not exist in the registry of the database server, exception 1469 (Time zone not found) is raised.
The following example shows the use of the createTimeZoneByLocationWindows method that converts a timestamp from the database server to the time zone of the client node.
example_createTimeZoneByLocationWindows(); vars clientTimeStamp: TimeStamp; clientTimeZone: JadeTimeZone; databaseTime: Time; databaseDate: Date; databaseTimeStamp: TimeStamp; databaseTimeZone: JadeTimeZone; begin /* Some setup to create a timestamp for the database server, usually the database server would pass this through to the client node */ databaseTime.setTime(18,0,0,0); databaseDate.setDate(1,6,2020); databaseTimeStamp.setTime(databaseTime); databaseTimeStamp.setDate(databaseDate); clientTimeZone := JadeTimeZone@createTimeZoneByLocationWindows(PresentationClient); // Create a JadeTimeZone for the client node databaseTimeZone := JadeTimeZone@createTimeZoneByLocationWindows(DatabaseServer); // Create a JadeTimeZone for the database server clientTimeStamp := databaseTimeZone.convertTimeByTimeZone(databaseTimeStamp, clientTimeZone); // Convert the timestamp from database time to client time write "The given timestamp is " & clientTimeStamp.String & ", local time"; epilog delete clientTimeZone; delete databaseTimeZone; end;
2020.0.01 and higher