Example usage for java.util SimpleTimeZone SimpleTimeZone

List of usage examples for java.util SimpleTimeZone SimpleTimeZone

Introduction

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

Prototype

public SimpleTimeZone(int rawOffset, String ID, int startMonth, int startDay, int startDayOfWeek, int startTime,
        int endMonth, int endDay, int endDayOfWeek, int endTime, int dstSavings) 

Source Link

Document

Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.

Usage

From source file:Test.java

public static void main(String[] args) {
    SimpleTimeZone simpleTimeZone = new SimpleTimeZone(-21600000, "CST", Calendar.MARCH, 1, -Calendar.SUNDAY,
            7200000, Calendar.NOVEMBER, -1, Calendar.SUNDAY, 7200000, 3600000);

    System.out.println(simpleTimeZone.getDisplayName() + " - " + simpleTimeZone.observesDaylightTime());

}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(-28800000, "India", Calendar.MAY, 1, -Calendar.SUNDAY, 7200000,
            Calendar.OCTOBER, -1, Calendar.MONDAY, 7200000, 3600000);

    // setting DST saving time
    stobj.setDSTSavings(5400000);/*w  ww.j  av a2s.  c  o  m*/

    // checking the value      
    System.out.println("DST saving value : " + stobj.getDSTSavings());
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(-28800000, "America/Los_Angeles", Calendar.AUGUST, 1,
            -Calendar.SUNDAY, 7200000, Calendar.DECEMBER, -1, Calendar.SUNDAY, 7200000, 3600000);

    // checking the initial value      
    System.out.println("Initial value : " + stobj);

    // setting end rule
    stobj.setEndRule(Calendar.MAY, 2, Calendar.TUESDAY, 3600000);

    // checking the new value      
    System.out.println("New value : " + stobj);
}