Home
last modified time | relevance | path

Searched refs:cal (Results 1 – 25 of 37) sorted by relevance

12

/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/
DCalendarTest.java41 Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("EST")); in test_setII() local
43 cal.clear(); in test_setII()
44 cal.set(Calendar.YEAR, 2002); in test_setII()
45 assertTrue("Incorrect result 0: " + cal.getTime().getTime(), cal in test_setII()
48 cal.clear(); in test_setII()
49 cal.set(Calendar.YEAR, 2002); in test_setII()
50 cal.set(Calendar.MONTH, Calendar.MARCH); in test_setII()
51 assertTrue("Incorrect result 0a: " + cal.getTime(), cal.getTime() in test_setII()
54 cal.clear(); in test_setII()
55 cal.set(Calendar.YEAR, 2002); in test_setII()
[all …]
DGregorianCalendarTest.java560 GregorianCalendar cal = new GregorianCalendar(); in test_rollIZ() local
563 cal.roll(Calendar.ZONE_OFFSET, true); in test_rollIZ()
570 cal.roll(Calendar.DST_OFFSET, true); in test_rollIZ()
577 cal.set(2004, Calendar.DECEMBER, 31, 5, 0, 0); in test_rollIZ()
578 cal.roll(Calendar.WEEK_OF_YEAR, true); in test_rollIZ()
579 assertEquals("Wrong year: " + cal.getTime(), 2004, cal in test_rollIZ()
581 assertEquals("Wrong month: " + cal.getTime(), Calendar.JANUARY, cal in test_rollIZ()
585 assertEquals("Wrong date: " + cal.getTime(), 2, cal.get(Calendar.DATE)); in test_rollIZ()
588 cal.set(1994, 11, 30, 5, 0, 0); in test_rollIZ()
589 cal.setMinimalDaysInFirstWeek(4); in test_rollIZ()
[all …]
DDateTest.java55 Calendar cal = new GregorianCalendar(1999, Calendar.JUNE, 22); in test_ConstructorIII() local
56 assertTrue("Wrong time zone", date.equals(cal.getTime())); in test_ConstructorIII()
304 GregorianCalendar cal = new GregorianCalendar(); in test_parseLjava_lang_String() local
305 cal.setTime(d); in test_parseLjava_lang_String()
306 assertEquals("Parsed incorrect month", 9, cal.get(Calendar.MONTH)); in test_parseLjava_lang_String()
307 assertEquals("Parsed incorrect year", 1998, cal.get(Calendar.YEAR)); in test_parseLjava_lang_String()
308 assertEquals("Parsed incorrect date", 13, cal.get(Calendar.DATE)); in test_parseLjava_lang_String()
317 cal.setTimeZone(TimeZone.getTimeZone("GMT")); in test_parseLjava_lang_String()
318 cal.clear(); in test_parseLjava_lang_String()
319 cal.set(1969, Calendar.JANUARY, 12, 1, 0); in test_parseLjava_lang_String()
[all …]
/libcore/luni/src/test/java/libcore/java/util/
DGregorianCalendarTest.java216 GregorianCalendar cal = new GregorianCalendar(); in test_setWeekDate() local
219 cal.setMinimalDaysInFirstWeek(4); in test_setWeekDate()
220 cal.setWeekDate(2016, 13, Calendar.TUESDAY); in test_setWeekDate()
221 assertEquals(Calendar.TUESDAY, cal.get(Calendar.DAY_OF_WEEK)); in test_setWeekDate()
222 assertEquals(29, cal.get(Calendar.DAY_OF_MONTH)); in test_setWeekDate()
225 cal.setMinimalDaysInFirstWeek(1); in test_setWeekDate()
226 cal.setWeekDate(2016, 13, Calendar.TUESDAY); in test_setWeekDate()
227 assertEquals(Calendar.TUESDAY, cal.get(Calendar.DAY_OF_WEEK)); in test_setWeekDate()
228 assertEquals(22, cal.get(Calendar.DAY_OF_MONTH)); in test_setWeekDate()
231 cal.setWeekDate(2016, 13, Calendar.SATURDAY + 1); in test_setWeekDate()
[all …]
DOldFormatterTest.java56 Calendar cal = Calendar.getInstance(); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object() local
59 cal.set(2008, Calendar.SEPTEMBER, 23, 18, 30); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
81 fLoc.format(Locale.US, "%tA %tB %td %tT", cal, cal, cal, cal); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
82 fNoL.format("%tA %tB %td %tT", cal, cal, cal, cal); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
87 fLoc.format(Locale.US, "%tA %tB %td %tT", cal, cal, cal, cal); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
88 fNoL.format("%tA %tB %td %tT", cal, cal, cal, cal); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
93 fLoc.format(Locale.US, "%tA %tB %td %tT", cal, cal, cal, cal); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
94 fNoL.format("%tA %tB %td %tT", cal, cal, cal, cal); in test_formatLjava_util_LocaleLjava_lang_StringLjava_lang_Object()
DSimpleTimeZoneTest.java210 GregorianCalendar cal = new GregorianCalendar(timeZone, Locale.ENGLISH); in findDstEntryAndExit() local
211 cal.setTimeInMillis(startOfYearMillis); in findDstEntryAndExit()
212 int year = cal.get(Calendar.YEAR); in findDstEntryAndExit()
213 while (!timeZone.inDaylightTime(new Date(cal.getTimeInMillis()))) { in findDstEntryAndExit()
215 if (cal.get(Calendar.YEAR) != year) { in findDstEntryAndExit()
219 cal.add(Calendar.HOUR_OF_DAY, 1); in findDstEntryAndExit()
222 cal.add(Calendar.MILLISECOND, -1); in findDstEntryAndExit()
223 assertFalse(timeZone.inDaylightTime(cal.getTime())); in findDstEntryAndExit()
224 cal.add(Calendar.MILLISECOND, 1); in findDstEntryAndExit()
225 long entryPoint = cal.getTimeInMillis(); in findDstEntryAndExit()
[all …]
DCalendarTest.java49 Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.US); in test_setTimeZone() local
50 assertEquals(0, cal.get(Calendar.ZONE_OFFSET)); in test_setTimeZone()
52 cal.setTimeZone(tz); in test_setTimeZone()
53 assertEquals(25200000, cal.get(Calendar.ZONE_OFFSET)); in test_setTimeZone()
229 GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles")); in test_clear_45877_morning() local
231 cal.setTimeInMillis(1454506360000L); in test_clear_45877_morning()
232 checkClear(cal, 0, 28800000); in test_clear_45877_morning()
237 GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("America/Los_Angeles")); in test_clear_45877_afternoon() local
239 cal.setTimeInMillis(1454531560000L); in test_clear_45877_afternoon()
240 checkClear(cal, 12, 72000000); in test_clear_45877_afternoon()
[all …]
/libcore/ojluni/src/test/java/time/test/java/time/chrono/
DTestIsoChronoImpl.java95 GregorianCalendar cal = new GregorianCalendar(); in test_IsoChrono_vsCalendar() local
96 assertEquals(cal.getCalendarType(), "gregory", "Unexpected calendar type"); in test_IsoChrono_vsCalendar()
99 cal.setTimeZone(TimeZone.getTimeZone("GMT+00")); in test_IsoChrono_vsCalendar()
100 cal.set(Calendar.YEAR, isoDate.get(YEAR)); in test_IsoChrono_vsCalendar()
101 cal.set(Calendar.MONTH, isoDate.get(MONTH_OF_YEAR) - 1); in test_IsoChrono_vsCalendar()
102 cal.set(Calendar.DAY_OF_MONTH, isoDate.get(DAY_OF_MONTH)); in test_IsoChrono_vsCalendar()
105 …ertEquals(isoDate.get(DAY_OF_MONTH), cal.get(Calendar.DAY_OF_MONTH), "Day mismatch in " + isoDate … in test_IsoChrono_vsCalendar() local
106 …assertEquals(isoDate.get(MONTH_OF_YEAR), cal.get(Calendar.MONTH) + 1, "Month mismatch in " + isoDa… in test_IsoChrono_vsCalendar()
107 … assertEquals(isoDate.get(YEAR_OF_ERA), cal.get(Calendar.YEAR), "Year mismatch in " + isoDate); in test_IsoChrono_vsCalendar()
110 cal.add(Calendar.DAY_OF_MONTH, 1); in test_IsoChrono_vsCalendar()
[all …]
DTestThaiBuddhistChronoImpl.java97 Calendar cal = java.util.Calendar.getInstance(locale); in test_ThaiBuddhistChrono_vsCalendar() local
98 assertEquals(cal.getCalendarType(), "buddhist", "Unexpected calendar type"); in test_ThaiBuddhistChrono_vsCalendar()
102 cal.setTimeZone(TimeZone.getTimeZone("GMT+00")); in test_ThaiBuddhistChrono_vsCalendar()
103 cal.set(Calendar.YEAR, thaiDate.get(ChronoField.YEAR)); in test_ThaiBuddhistChrono_vsCalendar()
104 cal.set(Calendar.MONTH, thaiDate.get(ChronoField.MONTH_OF_YEAR) - 1); in test_ThaiBuddhistChrono_vsCalendar()
105 cal.set(Calendar.DAY_OF_MONTH, thaiDate.get(ChronoField.DAY_OF_MONTH)); in test_ThaiBuddhistChrono_vsCalendar()
108 …Date.get(ChronoField.DAY_OF_MONTH), cal.get(Calendar.DAY_OF_MONTH), "Day mismatch in " + thaiDate … in test_ThaiBuddhistChrono_vsCalendar() local
109 …assertEquals(thaiDate.get(ChronoField.MONTH_OF_YEAR), cal.get(Calendar.MONTH) + 1, "Month mismatch… in test_ThaiBuddhistChrono_vsCalendar()
110 …assertEquals(thaiDate.get(ChronoField.YEAR_OF_ERA), cal.get(Calendar.YEAR), "Year mismatch in " + … in test_ThaiBuddhistChrono_vsCalendar()
113 cal.add(Calendar.DAY_OF_MONTH, 1); in test_ThaiBuddhistChrono_vsCalendar()
[all …]
DTestJapaneseChronoImpl.java102 Calendar cal = Calendar.getJapaneseImperialInstance(TimeZone.getDefault(), locale); in test_JapaneseChrono_vsCalendar() local
103 assertEquals(cal.getCalendarType(), "japanese", "Unexpected calendar type"); in test_JapaneseChrono_vsCalendar()
110 cal.setTimeZone(TimeZone.getTimeZone("GMT+00")); in test_JapaneseChrono_vsCalendar()
111 cal.setTimeInMillis(millis); in test_JapaneseChrono_vsCalendar()
114 …(jDate.get(ChronoField.DAY_OF_MONTH), cal.get(Calendar.DAY_OF_MONTH), "Day mismatch in " + jDate +… in test_JapaneseChrono_vsCalendar() local
115 …assertEquals(jDate.get(ChronoField.MONTH_OF_YEAR), cal.get(Calendar.MONTH) + 1, "Month mismatch in… in test_JapaneseChrono_vsCalendar()
116 …assertEquals(jDate.get(ChronoField.YEAR_OF_ERA), cal.get(Calendar.YEAR), "Year mismatch in " + jDa… in test_JapaneseChrono_vsCalendar()
119 cal.add(Calendar.DAY_OF_MONTH, 1); in test_JapaneseChrono_vsCalendar()
130 Calendar cal = java.util.Calendar.getInstance(locale); in test_dayOfYearVsCalendar() local
137 cal.setTimeZone(TimeZone.getTimeZone("GMT+00")); in test_dayOfYearVsCalendar()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/text/
DSimpleDateFormatTest.java257 Calendar cal = new GregorianCalendar(1999, Calendar.JUNE, 2, 15, 3, 6); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition() local
258 assertFormat(format, " G", cal, " AD", DateFormat.ERA_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
259 assertFormat(format, " GG", cal, " AD", DateFormat.ERA_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
260 assertFormat(format, " GGG", cal, " AD", DateFormat.ERA_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
266 assertFormat(format, " y", cal, " 1999", DateFormat.YEAR_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
267 assertFormat(format, " yy", cal, " 99", DateFormat.YEAR_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
274 assertFormat(format, " yyy", cal, " 1999", DateFormat.YEAR_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
275 assertFormat(format, " yyyy", cal, " 1999", DateFormat.YEAR_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
276 assertFormat(format, " yyyyy", cal, " 01999", DateFormat.YEAR_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
278 assertFormat(format, " M", cal, " 6", DateFormat.MONTH_FIELD); in test_formatLjava_util_DateLjava_lang_StringBufferLjava_text_FieldPosition()
[all …]
DSupport_SimpleDateFormat.java50 Calendar cal = new GregorianCalendar(tz); in t_format_with_FieldPosition() local
51 cal.set(1999, Calendar.SEPTEMBER, 13, 17, 19, 01); in t_format_with_FieldPosition()
52 cal.set(Calendar.MILLISECOND, 0); in t_format_with_FieldPosition()
53 Date date = cal.getTime(); in t_format_with_FieldPosition()
134 Calendar cal = new GregorianCalendar(tz); in t_formatToCharacterIterator() local
135 cal.set(1999, Calendar.SEPTEMBER, 13, 17, 19, 01); in t_formatToCharacterIterator()
136 cal.set(Calendar.MILLISECOND, 0); in t_formatToCharacterIterator()
137 Date date = cal.getTime(); in t_formatToCharacterIterator()
/libcore/luni/src/main/java/javax/xml/datatype/
DDuration.java333 Calendar cal = (Calendar) startInstant.clone(); in getTimeInMillis() local
334 addTo(cal); in getTimeInMillis()
335 return getCalendarTimeInMillis(cal) in getTimeInMillis()
371 Calendar cal = new GregorianCalendar(); in getTimeInMillis() local
372 cal.setTime(startInstant); in getTimeInMillis()
373 this.addTo(cal); in getTimeInMillis()
374 return getCalendarTimeInMillis(cal) - startInstant.getTime(); in getTimeInMillis()
558 Calendar cal = new GregorianCalendar(); in addTo() local
559 cal.setTime(date); in addTo()
560 this.addTo(cal); in addTo()
[all …]
/libcore/ojluni/src/test/java/time/test/java/util/
DTestFormatter.java112 Calendar cal; in test() local
114 cal = Calendar.getJapaneseImperialInstance(tz, calLocale); in test()
116 cal = Calendar.getInstance(tz, calLocale); in test()
118 cal.setTimeInMillis(instant.toEpochMilli()); in test()
121 testDate(fmtStr, locale, zdt, cal); in test()
124 testTime(fmtStr, locale, zdt, cal); in test()
126 testZoneId(locale, zdt, cal); in test()
127 testInstant(locale, instant, zdt, cal); in test()
182 ChronoZonedDateTime<?> zdt, Calendar cal) { in testDate() argument
184 String expected = test(fmtStr, locale, null, cal); in testDate()
[all …]
/libcore/ojluni/src/main/java/sun/util/calendar/
DCalendarSystem.java155 CalendarSystem cal = calendars.get(calendarName); in forName() local
156 if (cal != null) { in forName()
157 return cal; in forName()
167 cal = LocalGregorianCalendar.getLocalGregorianCalendar(calendarName); in forName()
170 cal = (CalendarSystem) calendarClass.newInstance(); in forName()
175 if (cal == null) { in forName()
178 CalendarSystem cs = calendars.putIfAbsent(calendarName, cal); in forName()
179 return (cs == null) ? cal : cs; in forName()
/libcore/ojluni/src/main/java/java/util/
DDate.java253 BaseCalendar cal = getCalendarSystem(y); in Date() local
254 cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.getDefaultRef()); in Date()
329 BaseCalendar cal = getCalendarSystem(y); in UTC() local
330 BaseCalendar.Date udate = (BaseCalendar.Date) cal.newCalendarDate(null); in UTC()
625 BaseCalendar cal = getCalendarSystem(year); in parse() local
627 … BaseCalendar.Date ldate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.getDefaultRef()); in parse()
630 return cal.getTime(ldate); in parse()
632 BaseCalendar.Date udate = (BaseCalendar.Date) cal.newCalendarDate(null); // no time zone in parse()
635 return cal.getTime(udate) + tzoffset * (60 * 1000); in parse()
1142 BaseCalendar cal = getCalendarSystem(t); in toGMTString() local
[all …]
DSimpleTimeZone.java558 BaseCalendar cal = date >= GregorianCalendar.DEFAULT_GREGORIAN_CUTOVER ? in getOffsets() local
560 BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); in getOffsets()
562 cal.getCalendarDate(date + rawOffset, cdate); in getOffsets()
567 offset = getOffset(cal, cdate, year, date); in getOffsets()
635 BaseCalendar cal = gcal; in getOffset() local
636 BaseCalendar.Date cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); in getOffset()
638 long time = cal.getTime(cdate); // normalize cdate in getOffset()
648 cal = (BaseCalendar) CalendarSystem.forName("julian"); in getOffset()
649 cdate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); in getOffset()
651 time = cal.getTime(cdate) + millis - rawOffset; in getOffset()
[all …]
DGregorianCalendar.java1328 BaseCalendar cal; in roll() local
1330 cal = getCutoverCalendarSystem(); in roll()
1332 cal = gcal; in roll()
1334 cal = getJulianCalendarSystem(); in roll()
1338 if (cal.getYearFromFixedDate(day1) != y) { in roll()
1344 cal = (fd >= gregorianCutoverDate) ? gcal : getJulianCalendarSystem(); in roll()
1345 if (cal.getYearFromFixedDate(fd) != y) { in roll()
1513 BaseCalendar cal = (fd >= gregorianCutoverDate) ? gcal : getJulianCalendarSystem(); in roll() local
1514 BaseCalendar.Date d = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE); in roll()
1515 cal.getCalendarDateFromFixedDate(d, fd); in roll()
[all …]
DCalendar.java1463 Calendar cal; in build() local
1483 cal = new GregorianCalendar(zone, locale, true); in build()
1491 cal = gcal; in build()
1505 cal.setLenient(lenient); in build()
1507 cal.setFirstDayOfWeek(firstDayOfWeek); in build()
1508 cal.setMinimalDaysInFirstWeek(minimalDaysInFirstWeek); in build()
1511 cal.setTimeInMillis(instant); in build()
1512 cal.complete(); in build()
1513 return cal; in build()
1519 if (weekDate && !cal.isWeekDateSupported()) { in build()
[all …]
/libcore/ojluni/src/main/java/java/text/
DCalendarBuilder.java103 Calendar establish(Calendar cal) { in establish() argument
106 if (weekDate && !cal.isWeekDateSupported()) { in establish()
114 cal.clear(); in establish()
120 cal.set(index, field[MAX_FIELD + index]); in establish()
129 field[MAX_FIELD + DAY_OF_WEEK] : cal.getFirstDayOfWeek(); in establish()
130 if (!isValidDayOfWeek(dayOfWeek) && cal.isLenient()) { in establish()
143 cal.setWeekDate(field[MAX_FIELD + WEEK_YEAR], weekOfYear, dayOfWeek); in establish()
145 return cal; in establish()
/libcore/ojluni/src/main/java/java/util/logging/
DXMLFormatter.java59 GregorianCalendar cal = new GregorianCalendar(); in appendISO8601() local
60 cal.setTimeInMillis(millis); in appendISO8601()
61 sb.append(cal.get(Calendar.YEAR)); in appendISO8601()
63 a2(sb, cal.get(Calendar.MONTH) + 1); in appendISO8601()
65 a2(sb, cal.get(Calendar.DAY_OF_MONTH)); in appendISO8601()
67 a2(sb, cal.get(Calendar.HOUR_OF_DAY)); in appendISO8601()
69 a2(sb, cal.get(Calendar.MINUTE)); in appendISO8601()
71 a2(sb, cal.get(Calendar.SECOND)); in appendISO8601()
/libcore/support/src/test/java/tests/support/
DSupport_TimeZone.java54 GregorianCalendar cal = new GregorianCalendar(); in inDaylightTime() local
55 cal.setTime(p1); in inDaylightTime()
56 int month = cal.get(Calendar.MONTH); in inDaylightTime()
/libcore/ojluni/src/main/java/java/sql/
DCallableStatement.java523 java.sql.Date getDate(int parameterIndex, Calendar cal) in getDate() argument
548 java.sql.Time getTime(int parameterIndex, Calendar cal) in getTime() argument
574 java.sql.Timestamp getTimestamp(int parameterIndex, Calendar cal) in getTimestamp() argument
1248 void setDate(String parameterName, java.sql.Date x, Calendar cal) in setDate() argument
1273 void setTime(String parameterName, java.sql.Time x, Calendar cal) in setTime() argument
1298 void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal) in setTimestamp() argument
1692 java.sql.Date getDate(String parameterName, Calendar cal) in getDate() argument
1718 java.sql.Time getTime(String parameterName, Calendar cal) in getTime() argument
1745 java.sql.Timestamp getTimestamp(String parameterName, Calendar cal) in getTimestamp() argument
/libcore/ojluni/src/main/java/javax/sql/
DRowSet.java1687 void setDate(int parameterIndex, java.sql.Date x, Calendar cal) in setDate() argument
1730 void setDate(String parameterName, java.sql.Date x, Calendar cal) in setDate() argument
1744 void setTime(int parameterIndex, java.sql.Time x, Calendar cal) in setTime() argument
1785 void setTime(String parameterName, java.sql.Time x, Calendar cal) in setTime() argument
1801 void setTimestamp(int parameterIndex, java.sql.Timestamp x, Calendar cal) in setTimestamp() argument
1825 void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal) in setTimestamp() argument
/libcore/luni/src/test/java/libcore/java/security/cert/
DX509CertificateTest.java413 Calendar cal = Calendar.getInstance(); in checkValidity() local
429 cal.setTime(dates[0]); in checkValidity()
430 cal.add(Calendar.DAY_OF_MONTH, 1); in checkValidity()
431 c.checkValidity(cal.getTime()); in checkValidity()
434 cal.setTime(dates[1]); in checkValidity()
435 cal.add(Calendar.SECOND, -1); in checkValidity()
436 c.checkValidity(cal.getTime()); in checkValidity()
439 cal.setTime(dates[0]); in checkValidity()
440 cal.add(Calendar.SECOND, -1); in checkValidity()
441 c.checkValidity(cal.getTime()); in checkValidity()
[all …]

12