Java Date Time - 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;
//w  w  w .  j  a  v a  2s.  com
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: