Package java.util

Examples of java.util.TimeZone.useDaylightTime()


    int offset = zone.getRawOffset() / 1000;
    int hour = offset / 3600;
    int min = (offset % 3600) / 60;
    DateFormat dfm = new SimpleDateFormat("z");
    dfm.setTimeZone(zone);
    boolean hasDaylight = zone.useDaylightTime();
    String first = dfm.format(new GregorianCalendar(2010, 1, 1).getTime()).substring(0, 3); // make it only 3 letters code
    String second = dfm.format(new GregorianCalendar(2011, 6, 6).getTime()).substring(0, 3); // make it only 3 letters code
    int mid = hour * -1;
    timezoneShortForm = first + Integer.toString(mid);
    if (min != 0) {
View Full Code Here


         *
         * By default, Java takes the any time that has ambiguities as standard
         * time, so we only need to check for the case when we don't prefer
         * standard time.
         */
        if (!preferStandardTimeValue && tz.useDaylightTime())
        {
            // only relevant if we prefer daylight savings on
            // ambiguities and if the time zone supports daylight savings
           
            int dstoffsetMillis = calendar
View Full Code Here

        TimeZone tz = TimeZone.getDefault();

        tzname = new PyTuple(new PyObject[] { new PyString(getDisplayName(tz, false, 0)),
                new PyString(getDisplayName(tz, true, 0)) });

        daylight = tz.useDaylightTime() ? 1 : 0;
        timezone = -tz.getRawOffset() / 1000;
        altzone = timezone - getDSTSavings(tz) / 1000;
    }

    public static double time() {
View Full Code Here

                    tzNames.put(zone[LONG_STD], tz);
                }
                if (!tzNames.containsKey(zone[SHORT_STD])){
                    tzNames.put(zone[SHORT_STD], tz);
                }
                if (tz.useDaylightTime()) {
                    if (!tzNames.containsKey(zone[LONG_DST])){
                        tzNames.put(zone[LONG_DST], tz);
                    }
                    if (!tzNames.containsKey(zone[SHORT_DST])){
                        tzNames.put(zone[SHORT_DST], tz);
View Full Code Here

         * {@inheritDoc}
         */
        @Override
        public void appendTo(final StringBuffer buffer, final Calendar calendar) {
            final TimeZone zone = calendar.getTimeZone();
            if (zone.useDaylightTime()
                    && calendar.get(Calendar.DST_OFFSET) != 0) {
                buffer.append(getTimeZoneDisplay(zone, true, mStyle, mLocale));
            } else {
                buffer.append(getTimeZoneDisplay(zone, false, mStyle, mLocale));
            }
View Full Code Here

            if (tz == null)      return;

            // otherwise print out normally.
            int offset;
            if (tz.inDaylightTime(cal.getTime())) {
                offset = tz.getRawOffset() + (tz.useDaylightTime()?3600000:0);
            } else {
                offset = tz.getRawOffset();
            }

            if(offset==0) {
View Full Code Here

    for (int i = 0; i < ids.length; i++) {
      TimeZone tz = TimeZone.getTimeZone(ids[i]);
     
      addAbbreviation(array, tz, false);
     
      if (tz.useDaylightTime())
        addAbbreviation(array, tz, true);
    }
   
    return array;
  }
View Full Code Here

    String []zoneIDs = TimeZone.getAvailableIDs(offset * 1000);
   
    for (int i = 0; i < zoneIDs.length; i++) {
      TimeZone zone = TimeZone.getTimeZone(zoneIDs[i]);

      if (isDST == zone.useDaylightTime())
        return StringValue.create(zoneIDs[i]);
    }

    return BooleanValue.FALSE;
  }
View Full Code Here

        TimeZone tz = TimeZone.getDefault();

        tzname = new PyTuple(new PyString(tz.getDisplayName(false, 0)),
                             new PyString(tz.getDisplayName(true, 0)));

        daylight = tz.useDaylightTime() ? 1 : 0;
        timezone = -tz.getRawOffset() / 1000;
        altzone = timezone - tz.getDSTSavings() / 1000;
    }

    public static double time() {
View Full Code Here

     * @param self a Date
     * @return the DST offset as a Duration.
     */
    public static Duration getDaylightSavingsOffset(Date self) {
        TimeZone timeZone = getTimeZone(self);
        int millis = (timeZone.useDaylightTime() && timeZone.inDaylightTime(self))
                ? timeZone.getDSTSavings() : 0;
        return new TimeDuration(0, 0, 0, millis);
    }

    public static Duration getDaylightSavingsOffset(BaseDuration self) {
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.