Example usage for java.util TimeZone getTimeZone

List of usage examples for java.util TimeZone getTimeZone

Introduction

In this page you can find the example usage for java.util TimeZone getTimeZone.

Prototype

public static TimeZone getTimeZone(ZoneId zoneId) 

Source Link

Document

Gets the TimeZone for the given zoneId .

Usage

From source file:Main.java

public static void main(String args[]) {

    TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");

    // checking offset value       
    System.out.println("Offset value is :" + timezone.getOffset(1, 2011, 2, 2, 2, 300));
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");

    // checking ID of this time zone         
    System.out.println("ID value is :" + timezone.getID());
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");

    // checking DST saving         
    System.out.println("DST saving is :" + timezone.getDSTSavings());
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone tzone = TimeZone.getTimeZone("America/Los_Angeles");

    // set time zone to default
    tzone.setDefault(tzone);// w w w. jav  a  2s.  co m

    // checking default time zone
    System.out.println("Default time zone:" + tzone);
}

From source file:Main.java

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

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

From source file:Main.java

public static void main(String[] args) {
    TimeZone timezone = TimeZone.getTimeZone("America/Los_Angeles");
    Calendar cal = Calendar.getInstance(timezone);
}

From source file:Main.java

public static void main(String[] args) {

    TimeZone tz1 = TimeZone.getTimeZone("GMT");
    Calendar cal1 = Calendar.getInstance(tz1);

    // display time zone for both calendars
    System.out.println("GMT: " + cal1.getTimeZone().getDisplayName());
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone timezone = TimeZone.getTimeZone("Europe/Paris");

    // checking offset value for date      
    System.out.println("Offset value:" + timezone.getOffset(Calendar.ZONE_OFFSET));
}

From source file:MainClass.java

public static void main(String[] a) {
    GregorianCalendar calendar = new GregorianCalendar(TimeZone.getTimeZone("America/Chicago"));
    System.out.println(calendar);
}

From source file:Main.java

public static void main(String args[]) {

    // create default time zone object
    TimeZone timezone = TimeZone.getTimeZone("US");

    // get display name for specific locale
    String disname = timezone.getDisplayName(true, 1, new Locale("EN", "US"));

    // checking display name         
    System.out.println("Display name is :" + disname);
}