Package java.util

Examples of java.util.TimeZone.inDaylightTime()


        int hours = offset / (60 * 60 * 1000);
        int minutes = (offset - (hours * 60 * 60 * 1000)) / (60 * 1000);

        try
        {
            if (timeZone.useDaylightTime() && timeZone.inDaylightTime(this.getDate()))
            {
                hours += sign.equals("+") ? 1 : -1;
            }
        }
        catch (ParseException e)
View Full Code Here


  /**
   * Shows the current time zone (based on the current time) short name
   */
  private static String getShortTZName() {
    TimeZone tz = TimeZone.getDefault();
    return tz.getDisplayName(tz.inDaylightTime(new Date()), TimeZone.SHORT);
  }
 
  /**
   * Converts a unix timestamp in UTC to one that is relative to the local timezone
   */
 
View Full Code Here

      int gmtoff = Integer.parseInt(
        line.substring(start3 + 8, line.length()));

      harness.debug("Zone " + zone + " " + d +
        " isdst=" + isdst +
        " inDaylightTime=" + tz.inDaylightTime(d));
      harness.check(tz.inDaylightTime(d) == (isdst != 0));

      harness.debug("Zone " + zone + " " + d +
        " gmtoff=" + gmtoff +
        " getOffset=" + tz.getOffset(d.getTime()));
View Full Code Here

        line.substring(start3 + 8, line.length()));

      harness.debug("Zone " + zone + " " + d +
        " isdst=" + isdst +
        " inDaylightTime=" + tz.inDaylightTime(d));
      harness.check(tz.inDaylightTime(d) == (isdst != 0));

      harness.debug("Zone " + zone + " " + d +
        " gmtoff=" + gmtoff +
        " getOffset=" + tz.getOffset(d.getTime()));
      harness.check(tz.getOffset(d.getTime()) == gmtoff * 1000);
 
View Full Code Here

      -12600000, "Canada/Newfoundland",
      Calendar.MARCH, 8, -Calendar.SUNDAY, 60000,
      Calendar.NOVEMBER, 1, -Calendar.SUNDAY, 60000);

    cal.set(2037, Calendar.NOVEMBER, 1, 2, 30, 0);
    harness.check(tz1.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2037, Calendar.NOVEMBER, 1, 2, 31, 0);
    harness.check(!tz1.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2038, Calendar.JANUARY, 1, 2, 29, 0);
View Full Code Here

    cal.set(2037, Calendar.NOVEMBER, 1, 2, 30, 0);
    harness.check(tz1.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2037, Calendar.NOVEMBER, 1, 2, 31, 0);
    harness.check(!tz1.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2038, Calendar.JANUARY, 1, 2, 29, 0);
    harness.check(!tz1.inDaylightTime(new Date(cal.getTimeInMillis())));

    harness.checkPoint("test 2");
View Full Code Here

    cal.set(2037, Calendar.NOVEMBER, 1, 2, 31, 0);
    harness.check(!tz1.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2038, Calendar.JANUARY, 1, 2, 29, 0);
    harness.check(!tz1.inDaylightTime(new Date(cal.getTimeInMillis())));

    harness.checkPoint("test 2");

    TimeZone tz2 = new SimpleTimeZone(
      -12600000, "Test1",
View Full Code Here

      3600000);

    // NB this particular check fails on several proprietary JVMs
    // because the end time is interpreted with startTimeMode.
    cal.set(2037, Calendar.NOVEMBER, 1, 3, 30, 0);
    harness.check(tz2.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2037, Calendar.NOVEMBER, 1, 3, 31, 0);
    harness.check(!tz2.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2038, Calendar.JANUARY, 1, 3, 29, 0);
View Full Code Here

    // because the end time is interpreted with startTimeMode.
    cal.set(2037, Calendar.NOVEMBER, 1, 3, 30, 0);
    harness.check(tz2.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2037, Calendar.NOVEMBER, 1, 3, 31, 0);
    harness.check(!tz2.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2038, Calendar.JANUARY, 1, 3, 29, 0);
    harness.check(!tz2.inDaylightTime(new Date(cal.getTimeInMillis())));

    harness.checkPoint("test 3");
View Full Code Here

    cal.set(2037, Calendar.NOVEMBER, 1, 3, 31, 0);
    harness.check(!tz2.inDaylightTime(new Date(cal.getTimeInMillis())));

    cal.set(2038, Calendar.JANUARY, 1, 3, 29, 0);
    harness.check(!tz2.inDaylightTime(new Date(cal.getTimeInMillis())));

    harness.checkPoint("test 3");

    TimeZone tz3 = new SimpleTimeZone(
      -12600000, "Test2",
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.