change timezone()

This function changes a given date a from time zone b to time zone c.

Parameters


Parameter

Description

a

Date to be used for calculation.

b

(optional) Time zone to be used as source time zone for date a instead of its own. Default: The time zone of a.

Important note : The abbreviated forms should be avoided because some of them have been used for different time zones, making it impossible to ensure the usage of the correct one. Java only supports these forms for backwards compatibility reasons. After an update of the Java Virtual Machine or the operating system, it is possible that a profile returns a different result. Allowed abbreviations: "GMT", "UTC", "SYSTEM" (local time zone of server).

Examples:

America/New_York

Europe/Berlin

c

(optional) New time zone. Default: The local time zone.

Examples


Parameter a

Parameter b

Parameter c

Result

2010-12-20 19:23:34.0

Europe/Berlin

America/Detroit

2010-12-20 14:23:34.0

2010-12-20 19:23:34.0

Europe/Berlin

America/Los_Angeles

2010-12-20 11:23:34.0

2010-12-20 19:23:34.0

Asia/Dubai

America/Detroit

2010-12-20 10:23:34.0

2010-12-20 19:23:34.0

Dreamland

Europe/Berlin

2010-12-20 20:23:34.0

The last example uses an invalid time zone name ("Dreamland"), leading to the calculation from GMT to Central European Time ("Europe/Berlin").