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) 

Source Link

Document

Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID with no daylight saving time schedule.

Usage

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj1 = new SimpleTimeZone(820, "GMT");

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

    // check day light
    boolean daylight = stobj1.inDaylightTime(date);

    // checking the value of day light      
    System.out.println("Is in day light : " + daylight);
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "GMT");

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

    // setting start rule   
    stobj.setStartRule(Calendar.MAY, 2, 2, 3600000);

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

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "GMT");

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

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

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

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "GMT");

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

    // setting start rule   
    stobj.setStartRule(Calendar.MAY, 2, 3600000);

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

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "GMT");

    // 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);
}

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(820, "US");

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

    // setting start rule   
    stobj.setStartRule(Calendar.MAY, 2, 2, 3600000, true);

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

From source file:Main.java

public static void main(String args[]) {

    SimpleTimeZone stobj = new SimpleTimeZone(720, "US");

    // get offset
    int offset = stobj.getOffset(GregorianCalendar.AD, 2000, 10, 2, 4, 5000);

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

From source file:Main.java

public static void main(String args[]) {
    // create two simple time zone objects 
    SimpleTimeZone stobj1 = new SimpleTimeZone(720, "India");
    SimpleTimeZone stobj2 = new SimpleTimeZone(720, "India");

    // compare two objects      
    System.out.println("Comparison result: " + stobj1.equals(stobj2));
}

From source file:Main.java

public static void main(String args[]) {
    // create two simple time zone object 
    SimpleTimeZone stobj1 = new SimpleTimeZone(820, "US");
    SimpleTimeZone stobj2 = new SimpleTimeZone(820, "GMT");

    // check rules for both objects
    boolean samerule = stobj1.hasSameRules(stobj2);

    // checking the value       
    System.out.println("Hash same rule : " + samerule);
}

From source file:org.gogpsproject.parser.sp3.SP3Navigation.java

/**
 * @param args//from   w w  w. ja v  a2s  .co m
 */
public static void main(String[] args) {

    TimeZone.setDefault(TimeZone.getTimeZone("UTC"));

    Calendar c = Calendar.getInstance();
    //      c.set(Calendar.YEAR, 2011);
    //      c.set(Calendar.MONTH, 0);
    //      c.set(Calendar.DAY_OF_MONTH, 9);
    //      c.set(Calendar.HOUR_OF_DAY, 1);
    //      c.set(Calendar.MINUTE, 0);
    //      c.set(Calendar.SECOND, 0);
    //      c.set(Calendar.MILLISECOND, 0);
    c.setTimeZone(new SimpleTimeZone(0, ""));

    Time t = new Time(c.getTimeInMillis());

    System.out.println("ts: " + t.getMsec() + " " + (new Date(t.getMsec())));
    System.out.println("week: " + t.getGpsWeek());
    System.out.println("week sec: " + t.getGpsWeekSec());
    System.out.println("week day: " + t.getGpsWeekDay());
    System.out.println("week hour in day: " + t.getGpsHourInDay());
    System.out.println("year: " + t.getYear() + " " + t.getYear2c());
    System.out.println("day of year: " + t.getDayOfYear());

    System.out.println("ts2: " + (new Time(t.getGpsWeek(), t.getGpsWeekSec())).getMsec());

    //      SP3Navigation sp3n = new SP3Navigation(IGN_FR_ULTRARAPID);
    //      sp3n.init();
    //      SatellitePosition sp = sp3n.getGpsSatPosition(c.getTimeInMillis(), 2, 0, null);
    //      if(sp!=null){
    //         System.out.println("found "+(new Date(sp.getUtcTime()))+" "+(sp.isPredicted()?" predicted":""));
    //      }else{
    //         System.out.println("Epoch not found "+(new Date(c.getTimeInMillis())));
    //      }

}