Java TimeZone setID() Method

The setID(String ID) method of TimeZone class is used to set the TimeZone ID for the given location. This doesn't change any other data in the TimeZone object.

Syntax

Parameters

ID - the new TimeZone ID.

Example 1

Output:

TimeZone ID: GMT+08:00

Example 2

Output:

TimeZone ID:Etc/GMT+12