Home | History | Annotate | Download | only in calendar

Lines Matching defs:date

36  * <p><a name="fixed_date"></a><B>Fixed Date</B><br>
39 * have the common date numbering, starting from midnight the onset of
40 * Monday, January 1, 1 (Gregorian). It is called a <I>fixed date</I>
41 * in this class. January 1, 1 (Gregorian) is fixed date 1. (See
85 public void setEra(CalendarDate date, String eraName) {
92 date.setEra(e);
112 CalendarDate date = newCalendarDate(zone);
113 return getCalendarDate(millis, date);
116 public CalendarDate getCalendarDate(long millis, CalendarDate date) {
120 long days = 0; // fixed date
122 // adjust to local time if `date' has time zone.
123 TimeZone zi = date.getZone();
146 date.setZoneOffset(zoneOffset);
147 date.setDaylightSaving(saving);
164 // convert to fixed date (offset from Jan. 1, 1 (Gregorian))
167 // calculate date fields from the fixed date
168 getCalendarDateFromFixedDate(date, days);
171 setTimeOfDay(date, ms);
172 date.setLeapYear(isLeapYear(date));
173 date.setNormalized(true);
174 return date;
177 public long getTime(CalendarDate date) {
178 long gd = getFixedDate(date);
179 long ms = (gd - EPOCH_OFFSET) * DAY_IN_MILLIS + getTimeOfDay(date);
181 TimeZone zi = date.getZone();
183 if (date.isNormalized()) {
184 return ms - date.getZoneOffset();
188 if (date.isStandardTime()) {
216 getCalendarDate(ms, date);
220 protected long getTimeOfDay(CalendarDate date) {
221 long fraction = date.getTimeOfDay();
225 fraction = getTimeOfDayValue(date);
226 date.setTimeOfDay(fraction);
230 public long getTimeOfDayValue(CalendarDate date) {
231 long fraction = date.getHours();
233 fraction += date.getMinutes();
235 fraction += date.getSeconds();
237 fraction += date.getMillis();
259 // If this time of day setting doesn't affect the date,
275 protected abstract boolean isLeapYear(CalendarDate date);
277 public CalendarDate getNthDayOfWeek(int nth, int dayOfWeek, CalendarDate date) {
278 CalendarDate ndate = (CalendarDate) date.clone();
292 * Returns a date of the given day of week before the given fixed
293 * date.
295 * @param fixedDate the fixed date
297 * @return the calculated date
304 * Returns a date of the given day of week that is closest to and
305 * after the given fixed date.
307 * @param fixedDate the fixed date
309 * @return the calculated date
316 * Returns a date of the given day of week on or before the given fixed
317 * date.
319 * @param fixedDate the fixed date
321 * @return the calculated date
333 * Returns the fixed date calculated with the specified calendar
334 * date. If the specified date is not normalized, its date fields
337 * @param date a <code>CalendarDate</code> with which the fixed
338 * date is calculated
339 * @return the calculated fixed date
342 protected abstract long getFixedDate(CalendarDate date);
345 * Calculates calendar fields from the specified fixed date. This
349 * @param date a <code>CalendarDate</code> to stored the
351 * @param fixedDate a fixed date to calculate calendar fields
354 protected abstract void getCalendarDateFromFixedDate(CalendarDate date,
357 public boolean validateTime(CalendarDate date) {
358 int t = date.getHours();
362 t = date.getMinutes();
366 t = date.getSeconds();
371 t = date.getMillis();
379 int normalizeTime(CalendarDate date) {
380 long fraction = getTimeOfDay(date);
393 date.setTimeOfDay(fraction);
395 date.setMillis((int)(fraction % 1000));
397 date.setSeconds((int)(fraction % 60));
399 date.setMinutes((int)(fraction % 60));
400 date.setHours((int)(fraction / 60));