Java TimeZone.getTimeZone(String ID)

Syntax

TimeZone.getTimeZone(String ID) has the following syntax.

public static TimeZone getTimeZone(String ID)

Example

In the following code shows how to use TimeZone.getTimeZone(String ID) method.


import java.util.Date;
import java.util.TimeZone;
/*from w ww.ja  va 2 s .  co  m*/
public class Main {

  public static void main(String[] args) {
    TimeZone tz = TimeZone.getTimeZone("America/New_York");

    System.out.println(tz.inDaylightTime(new Date()));
  }
}

The output: