Example usage for java.util TimeZone getDefault

List of usage examples for java.util TimeZone getDefault

Introduction

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

Prototype

public static TimeZone getDefault() 

Source Link

Document

Gets the default TimeZone of the Java virtual machine.

Usage

From source file:Main.java

public static void main(String args[]) {

    TimeZone tzone = TimeZone.getDefault();

    // checking daylight time
    System.out.println("Using day light time :" + tzone.useDaylightTime());
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone timezone = TimeZone.getDefault();

    // checking raw offset value     
    System.out.println("Raw Offset value:" + timezone.getRawOffset());
}

From source file:Main.java

public static void main(String args[]) {
    TimeZone timezonedefault = TimeZone.getDefault();

    System.out.println(timezonedefault.observesDaylightTime());
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone tzone = TimeZone.getDefault();

    // set raw offset
    tzone.setRawOffset(10000);/*  w w w.  j a  v a  2  s.  c  o  m*/

    // checking offset value
    System.out.println("Offset value is :" + tzone.getRawOffset());
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone tzone = TimeZone.getDefault();

    // set time zone ID
    tzone.setID("GMT+08:00");

    // checking time zone ID
    System.out.println("Time zone ID:" + tzone.getID());
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone timezoneone = TimeZone.getDefault();
    TimeZone timezonetwo = TimeZone.getDefault();

    // comparing two time zones
    boolean res = timezoneone.hasSameRules(timezonetwo);

    // checking the result   
    System.out.println("Comparison result:" + res);
}

From source file:KVMTimeZones.java

public static void main(String[] args) {
    TimeZone defaultTZ = TimeZone.getDefault();
    String[] ids = TimeZone.getAvailableIDs();

    System.out.println("Available time zone ids: ");
    for (int i = 0; i < ids.length; i++) {
        System.out.print(ids[i] + " ");
    }/*from   w  w  w  .ja  v  a  2  s  .c  o m*/
    System.out.println(
            "\nDefault timezone is " + defaultTZ.getID() + ", GMT offset = " + defaultTZ.getRawOffset());
}

From source file:Main.java

public static void main(String[] args) {
    ZoneId defaultZone = TimeZone.getDefault().toZoneId();

    TimeZone tz = TimeZone.getTimeZone(defaultZone);
    System.out.println(tz);//from  w  ww.java 2  s .  c  o m
}

From source file:Main.java

public static void main(String args[]) {

    TimeZone timezoneone = TimeZone.getDefault();

    // create date object
    Date date = new Date();

    // checking day light
    System.out.println("In daylight time:" + timezoneone.inDaylightTime(date));
}

From source file:Main.java

public static void main(String args[]) {

    // create default time zone object
    TimeZone timezonedefault = TimeZone.getDefault();

    // checking default time zone value          
    System.out.println("Default time zone is :\n" + timezonedefault);
}