Package java.util

Examples of java.util.TimeZone.inDaylightTime()


        } else {
            sb.append("" + seconds);
        }

        double offset = cal.get(Calendar.ZONE_OFFSET);
        if (tz.inDaylightTime(inputDate)) {
            offset += (1.0 * tz.getDSTSavings()); // add the timezone's DST
            // value (typically 1 hour
            // expressed in milliseconds)
        }

View Full Code Here


        {
            c.setTime(date);
            TimeZone tz = c.getTimeZone();
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            dateString = sdf.format(date);
            tzString = tz.getDisplayName(tz.inDaylightTime(date), TimeZone.SHORT);
        } else
        {
            Date tDate = new Date();
            c.setTime(tDate);
            TimeZone tz = c.getTimeZone();
View Full Code Here

        {
            Date tDate = new Date();
            c.setTime(tDate);
            TimeZone tz = c.getTimeZone();
            dateString = "recent";
            tzString = tz.getDisplayName(tz.inDaylightTime(tDate), TimeZone.SHORT);
        }

        String query = String.format(HipChatConstants.ROOMS_HISTORY_QUERY_FORMAT, getId(), dateString, tzString, HipChatConstants.JSON_FORMAT,
                hc.getAuthToken());
View Full Code Here

    public void testParseLogDate() throws ParseException {
        TimeZone tz = TimeZone.getDefault();
        Date may18SixPM2001 = new GregorianCalendar(2001, 4, 18, 18, 0, 0).getTime();
        assertEquals(may18SixPM2001, CVS.LOGDATE.parse("2001/05/18 18:00:00 "
                + tz.getDisplayName(tz.inDaylightTime(may18SixPM2001), TimeZone.SHORT)));
    }

    public void testFormatCVSDateGMTPlusZero() {
        TimeZone.setDefault(TimeZone.getTimeZone("GMT+0:00"));
        Date mayEighteenSixPM2001 =
View Full Code Here

    public void testParseLogDate() throws ParseException {
        TimeZone tz = TimeZone.getDefault();
        Date may18SixPM2001 = new GregorianCalendar(2001, 4, 18, 18, 0, 0).getTime();
        assertEquals(may18SixPM2001, CVS.LOGDATE.parse("2001/05/18 18:00:00 "
                + tz.getDisplayName(tz.inDaylightTime(may18SixPM2001), TimeZone.SHORT)));
    }

    public void testFormatCVSDateGMTPlusZero() {
        TimeZone.setDefault(TimeZone.getTimeZone("GMT+0:00"));
        Date mayEighteenSixPM2001 =
View Full Code Here

                }
            }
            TimeZone tz = cal.getTimeZone();
            // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
            int offset = cal.get(Calendar.ZONE_OFFSET);
            if (tz.inDaylightTime(cal.getTime())) {
                offset += cal.get(Calendar.DST_OFFSET);
            }
            if (offset == 0) {
                pBuffer.append('Z');
            } else {
View Full Code Here

                }
            }
            TimeZone tz = cal.getTimeZone();
            // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
            int offset = cal.get(Calendar.ZONE_OFFSET);
            if (tz.inDaylightTime(cal.getTime())) {
                offset += cal.get(Calendar.DST_OFFSET);
            }
            if (offset == 0) {
                pBuffer.append('Z');
            } else {
View Full Code Here

        return calendar.getTimeZone();
    }

    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

                GregorianCalendar cal = new GregorianCalendar();
                cal.setTimeInMillis(f.lastModified());

                TimeZone tz = TimeZone.getDefault();
                long gmt = f.lastModified() - tz.getRawOffset();
                if (tz.useDaylightTime() && tz.inDaylightTime(cal.getTime())) {
                    gmt -= tz.getDSTSavings();
                }
                cal.setTimeInMillis(gmt);
                tree.addAttribute(_last_modified, String.format("%1$04d-%2$02d-%3$02dT%4$02d:%5$02d:%6$02dZ",
                        cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH),
View Full Code Here

            GregorianCalendar cal = new GregorianCalendar();
            cal.setTimeInMillis(file.lastModified());

            TimeZone tz = TimeZone.getDefault();
            long gmt = file.lastModified() - tz.getRawOffset();
            if (tz.useDaylightTime() && tz.inDaylightTime(cal.getTime())) {
                gmt -= tz.getDSTSavings();
            }
            cal.setTimeInMillis(gmt);
            tree.addAttribute(_last_modified, String.format("%1$04d-%2$02d-%3$02dT%4$02d:%5$02d:%6$02dZ",
                    cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH),
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.