Package com.ibm.icu.util

Examples of com.ibm.icu.util.SimpleTimeZone


        long ticks, millis;
        int i;

        /* Open a proleptic Gregorian calendar. */
        long before0001AD = -1000000 * dayMillis;
        utc = new SimpleTimeZone(0, "UTC");
        cal = new GregorianCalendar(utc, Locale.ENGLISH);
        cal.setGregorianChange(new Date(before0001AD));
        for(i = 0; i < dotNetDateTimeTicks.length; i += kIncrement) {
            /* Test conversion from .Net/Universal time to ICU time. */
            millis = UniversalTimeScale.toLong(dotNetDateTimeTicks[i + kTicks], UniversalTimeScale.ICU4C_TIME);
View Full Code Here


        }
        return (TimeZone)z.clone();
    }
   
    public static TimeZone getGMT(){
        TimeZone z = new SimpleTimeZone(0, kGMT_ID);
        z.setID(kGMT_ID);
        return z;
    }
View Full Code Here

    public static TimeZone getCustomTimeZone(String id){
        int[] fields = new int[4];
        if (parseCustomID(id, fields)) {
            String zid = formatCustomID(fields[1], fields[2], fields[3], fields[0] < 0);
            int offset = fields[0] * ((fields[1] * 60 + fields[2]) * 60 + fields[3]) * 1000;
            return new SimpleTimeZone(offset, zid);
        }
        return null;
    }
View Full Code Here

        hour = tmp / 60;

        // Note: No millisecond part included in TZID for now
        String zid = formatCustomID(hour, min, sec, negative);

        return new SimpleTimeZone(offset, zid);
    }
View Full Code Here

    private static class SimpleTimeZoneHandler extends TimeZoneHandler
    {
        public Object[] getTestObjects()
        {
            SimpleTimeZone simpleTimeZones[] = new SimpleTimeZone[6];
           
            simpleTimeZones[0] = new SimpleTimeZone(32400000, "MyTimeZone");
           
            simpleTimeZones[1] = new SimpleTimeZone(32400000, "Asia/Tokyo");
           
            simpleTimeZones[2] = new SimpleTimeZone(32400000, "Asia/Tokyo");
            simpleTimeZones[2].setRawOffset(0);
           
            simpleTimeZones[3] = new SimpleTimeZone(32400000, "Asia/Tokyo");
            simpleTimeZones[3].setStartYear(100);
           
            simpleTimeZones[4] = new SimpleTimeZone(32400000, "Asia/Tokyo");
            simpleTimeZones[4].setStartYear(1000);
            simpleTimeZones[4].setDSTSavings(1800000);
            simpleTimeZones[4].setStartRule(3, 4, 180000);
            simpleTimeZones[4].setEndRule(6, 3, 4, 360000);
           
            simpleTimeZones[5] = new SimpleTimeZone(32400000, "Asia/Tokyo");
            simpleTimeZones[5].setStartRule(2, 3, 4, 360000);
            simpleTimeZones[5].setEndRule(6, 3, 4, 360000);
           
            return simpleTimeZones;
        }
View Full Code Here

    }

    public void Test4040996() {
        try {
            String[] ids = TimeZone.getAvailableIDs(-8 * 60 * 60 * 1000);
            SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
            pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
            pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
            Calendar calendar = new GregorianCalendar(pdt);

            calendar.set(Calendar.MONTH,3);
            calendar.set(Calendar.DAY_OF_MONTH,18);
            calendar.set(Calendar.SECOND, 30);
View Full Code Here

     *
     * @param args the command line arguments.
     */
    public static void main(String[] args)
    {
        TimeZone utc = new SimpleTimeZone(0, "UTC");
        Calendar cal = Calendar.getInstance(utc, Locale.ENGLISH);
        MessageFormat fmt = new MessageFormat("{1} = {0, date, full} {0, time, full}");
        Object arguments[] = {cal, null};
       
        arguments[0] = cal;
View Full Code Here

    /*
     * Test case for checking if a TimeZone is properly set in the result calendar
     * and if the result TimeZone has the expected behavior.
     */
    public void TestTimeZoneRoundTrip() {
        TimeZone unknownZone = new SimpleTimeZone(-31415, "Etc/Unknown");
        int badDstOffset = -1234;
        int badZoneOffset = -2345;

        int[][] testDateData = {
            {2007, 1, 15},
View Full Code Here

    hour = tmp / 60;

    // Note: No millisecond part included in TZID for now
    String zid = formatCustomID(hour, min, sec, negative);

    return new SimpleTimeZone(offset, zid);
  }
View Full Code Here

      assert (data[1] >= 0 && data[1] <= kMAX_CUSTOM_HOUR);
      assert (data[2] >= 0 && data[2] <= kMAX_CUSTOM_MIN);
      assert (data[3] >= 0 && data[3] <= kMAX_CUSTOM_SEC);
      String id = formatCustomID(data[1], data[2], data[3], data[0] < 0);
      int offset = data[0] * ((data[1] * 60 + data[2]) * 60 + data[3]) * 1000;
      SimpleTimeZone tz = new SimpleTimeZone(offset, id);
      tz.freeze();
      return tz;
    }
View Full Code Here

TOP

Related Classes of com.ibm.icu.util.SimpleTimeZone

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.