Java TimeZone getTimeZone() Method

The getTimeZone(String ID) method of TimeZone class is used to get the TimeZone of the given ID.

Syntax

Parameters

ID - ID for a TimeZone.

Returns

It returns TimeZone for the given ID

Example 1

Output:

Time Zone:sun.util.calendar.ZoneInfo[id="Pacific/Palau",offset=32400000,dstSavings=0,useDaylight=false,transitions=3,
lastRule=null]

Example 2

Output:

Time Zone:sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]