Package java.util

Examples of java.util.TimeZone.inDaylightTime()


      // this is used to prevent duplicates in the list
      ArrayList descriptionList = new ArrayList();
      String[] zoneIds = TimeZone.getAvailableIDs();
      for (int i=0; i<zoneIds.length; i++) {
        TimeZone tz = TimeZone.getTimeZone(zoneIds[i]);
        String shortName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.SHORT);
        String longName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.LONG);
        int offset = tz.getOffset(today.getTime());
        int hour = offset / (60*60*1000);
        int min = Math.abs(offset / (60*1000)) % 60;
        StringBuffer description = new StringBuffer();
View Full Code Here


      ArrayList descriptionList = new ArrayList();
      String[] zoneIds = TimeZone.getAvailableIDs();
      for (int i=0; i<zoneIds.length; i++) {
        TimeZone tz = TimeZone.getTimeZone(zoneIds[i]);
        String shortName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.SHORT);
        String longName = tz.getDisplayName(tz.inDaylightTime(today), TimeZone.LONG);
        int offset = tz.getOffset(today.getTime());
        int hour = offset / (60*60*1000);
        int min = Math.abs(offset / (60*1000)) % 60;
        StringBuffer description = new StringBuffer();
        description.append(shortName+": ");
View Full Code Here

      TimeZone tz = TimeZone.getTimeZone(timeZoneID);
//      tz.setStartRule(Calendar.MARCH, -1, Calendar.SUNDAY,  2*60*60*1000);
//      tz.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY,  2*60*60*1000);

      date -= tz.getRawOffset();
      if (tz.inDaylightTime(sendTime)) {
        date -= 3600 * 1000;
      }

      return new SimpleDateFormat("yyyyMMddHHmm").format(new Date(date));
    }
View Full Code Here

                    }
                    g.drawString("" + tmpdate.getDate(), j * sizex / 7 + 4,
                            30 + i * 15 - 3);
                    tmpdate.go(Calendar.DATE, 1);
                    if (timeZone != null
                            && timeZone.inDaylightTime(tmpdate.getTime())) {
                        tmpdate.add(Calendar.MILLISECOND, timeZone
                                .getDSTSavings());
                        timeZone = null;
                    }

View Full Code Here

  public static String calendarToString(Calendar cal) {
    Calendar now = Calendar.getInstance();
    TimeZone tz = now.getTimeZone();
    int offset = tz.getRawOffset();

    if (tz.inDaylightTime(now.getTime())) {
      offset -= tz.getDSTSavings();
    }

    if (tz.inDaylightTime(cal.getTime())) {
      offset += tz.getDSTSavings();
View Full Code Here

    if (tz.inDaylightTime(now.getTime())) {
      offset -= tz.getDSTSavings();
    }

    if (tz.inDaylightTime(cal.getTime())) {
      offset += tz.getDSTSavings();
    }

    Date d = new Date(cal.getTimeInMillis() - offset);
    return new SimpleDateFormat("yyyy-MM-dd").format(d); //$NON-NLS-1$
View Full Code Here

                    if (region.equals(TIMEZONE_REGIONS[i]))
                    {
                        TimeZone tz = TimeZone.getTimeZone(id);
                        int offset = tz.getOffset(currentTime)/60000;
                        String city = id.substring(cityPos + 1).replace('_', ' ');
                        timeZoneDetails.add(new TimeZoneDetails(id, tz.getDisplayName(tz.inDaylightTime(currentDate), TimeZone.SHORT), offset, city, region));
                        break;
                    }
                }
            }
        }
View Full Code Here

        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

        public String convertToString(Object value, Locale locale)
        {
            if (value instanceof Calendar) {
                Calendar cal = (Calendar)value;
                TimeZone zone = cal.getTimeZone();
                return zone.getDisplayName( zone.inDaylightTime(cal.getTime()), TimeZone.SHORT, locale);
            }

            throw new RuntimeException("Don't know how to convert " + value.getClass() + " to a String");
        }
View Full Code Here

        public String convertToString(Object value, Locale locale)
        {
            if (value instanceof Calendar) {
                Calendar cal = (Calendar)value;
                TimeZone zone = cal.getTimeZone();
                return zone.getDisplayName( zone.inDaylightTime(cal.getTime()), TimeZone.SHORT, locale);
            }

            throw new RuntimeException("Don't know how to convert " + value.getClass() + " to a String");
        }
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.