Package sun.util.calendar

Examples of sun.util.calendar.BaseCalendar


                sec = 0;
            if (min < 0)
                min = 0;
            if (hour < 0)
                hour = 0;
      BaseCalendar cal = getCalendarSystem(year);
            if (tzoffset == -1)  { // no time zone specified, have to use local
    BaseCalendar.Date ldate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.getDefaultRef());
    ldate.setDate(year, mon + 1, mday);
    ldate.setTimeOfDay(hour, min, sec, 0);
                return cal.getTime(ldate);
      }
      BaseCalendar.Date udate = (BaseCalendar.Date) cal.newCalendarDate(null); // no time zone
      udate.setDate(year, mon + 1, mday);
      udate.setTimeOfDay(hour, min, sec, 0);
            return cal.getTime(udate) + tzoffset * (60 * 1000);
        }
        // syntax error
        throw new IllegalArgumentException();
    }
View Full Code Here


     */
    @Deprecated
    public String toGMTString() {
  // d MMM yyyy HH:mm:ss 'GMT'
  long t = getTime();
  BaseCalendar cal = getCalendarSystem(t);
  BaseCalendar.Date date =
      (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null);
  StringBuilder sb = new StringBuilder(32);
  CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d
  convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' ')// MMM
  sb.append(date.getYear()).append(' ');                            // yyyy
  CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':');      // HH
View Full Code Here

  return -zoneOffset/60000// convert to minutes
    }

    private final BaseCalendar.Date getCalendarDate() {
  if (cdate == null) {
      BaseCalendar cal = getCalendarSystem(fastTime);
      cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime,
                  TimeZone.getDefaultRef());
  }
  return cdate;
    }
View Full Code Here

  return cdate;
    }

    private final BaseCalendar.Date normalize() {
  if (cdate == null) {
      BaseCalendar cal = getCalendarSystem(fastTime);
      cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime,
                  TimeZone.getDefaultRef());
      return cdate;
  }

  // Normalize cdate with the TimeZone in cdate first. This is
  // required for the compatible behavior.
  if (!cdate.isNormalized()) {
      cdate = normalize(cdate);
  }

  // If the default TimeZone has changed, then recalculate the
  // fields with the new TimeZone.
  TimeZone tz = TimeZone.getDefaultRef();
  if (tz != cdate.getZone()) {
      cdate.setZone(tz);
      CalendarSystem cal = getCalendarSystem(cdate);
      cal.getCalendarDate(fastTime, cdate);
  }
  return cdate;
    }
View Full Code Here

        } else if (month < 0) {
            y += CalendarUtils.floorDivide(month, 12);
            month = CalendarUtils.mod(month, 12);
        }
        int m = month + 1;
        BaseCalendar cal = getCalendarSystem(y);
        BaseCalendar.Date udate = (BaseCalendar.Date) cal.newCalendarDate(null);
        udate.setNormalizedDate(y, m, date).setTimeOfDay(hrs, min, sec, 0);

        // Use a Date instance to perform normalization. Its fastTime
        // is the UTC value after the normalization.
        Date d = new Date(0);
View Full Code Here

                sec = 0;
            if (min < 0)
                min = 0;
            if (hour < 0)
                hour = 0;
            BaseCalendar cal = getCalendarSystem(year);
            if (tzoffset == -1)  { // no time zone specified, have to use local
                BaseCalendar.Date ldate = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.getDefaultRef());
                ldate.setDate(year, mon + 1, mday);
                ldate.setTimeOfDay(hour, min, sec, 0);
                return cal.getTime(ldate);
            }
            BaseCalendar.Date udate = (BaseCalendar.Date) cal.newCalendarDate(null); // no time zone
            udate.setDate(year, mon + 1, mday);
            udate.setTimeOfDay(hour, min, sec, 0);
            return cal.getTime(udate) + tzoffset * (60 * 1000);
        }
        // syntax error
        throw new IllegalArgumentException();
    }
View Full Code Here

     */
    @Deprecated
    public String toGMTString() {
        // d MMM yyyy HH:mm:ss 'GMT'
        long t = getTime();
        BaseCalendar cal = getCalendarSystem(t);
        BaseCalendar.Date date =
            (BaseCalendar.Date) cal.getCalendarDate(getTime(), (TimeZone)null);
        StringBuilder sb = new StringBuilder(32);
        CalendarUtils.sprintf0d(sb, date.getDayOfMonth(), 1).append(' '); // d
        convertToAbbr(sb, wtb[date.getMonth() - 1 + 2 + 7]).append(' ')// MMM
        sb.append(date.getYear()).append(' ');                            // yyyy
        CalendarUtils.sprintf0d(sb, date.getHours(), 2).append(':');      // HH
View Full Code Here

        return -zoneOffset/60000// convert to minutes
    }

    private final BaseCalendar.Date getCalendarDate() {
        if (cdate == null) {
            BaseCalendar cal = getCalendarSystem(fastTime);
            cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime,
                                                            TimeZone.getDefaultRef());
        }
        return cdate;
    }
View Full Code Here

        return cdate;
    }

    private final BaseCalendar.Date normalize() {
        if (cdate == null) {
            BaseCalendar cal = getCalendarSystem(fastTime);
            cdate = (BaseCalendar.Date) cal.getCalendarDate(fastTime,
                                                            TimeZone.getDefaultRef());
            return cdate;
        }

        // Normalize cdate with the TimeZone in cdate first. This is
        // required for the compatible behavior.
        if (!cdate.isNormalized()) {
            cdate = normalize(cdate);
        }

        // If the default TimeZone has changed, then recalculate the
        // fields with the new TimeZone.
        TimeZone tz = TimeZone.getDefaultRef();
        if (tz != cdate.getZone()) {
            cdate.setZone(tz);
            CalendarSystem cal = getCalendarSystem(cdate);
            cal.getCalendarDate(fastTime, cdate);
        }
        return cdate;
    }
View Full Code Here

            GregorianCalendar gc = new GregorianCalendar(tz);
            gc.clear();
            gc.set(GregorianCalendar.MILLISECOND, ms);
            gc.set(y, m-1, d, hh, mm, ss);
            fastTime = gc.getTimeInMillis();
            BaseCalendar cal = getCalendarSystem(fastTime);
            date = (BaseCalendar.Date) cal.getCalendarDate(fastTime, tz);
            return date;
        }

        BaseCalendar cal = getCalendarSystem(y);
        if (cal != getCalendarSystem(date)) {
            date = (BaseCalendar.Date) cal.newCalendarDate(tz);
            date.setNormalizedDate(y, m, d).setTimeOfDay(hh, mm, ss, ms);
        }
        // Perform the GregorianCalendar-style normalization.
        fastTime = cal.getTime(date);

        // In case the normalized date requires the other calendar
        // system, we need to recalculate it using the other one.
        BaseCalendar ncal = getCalendarSystem(fastTime);
        if (ncal != cal) {
            date = (BaseCalendar.Date) ncal.newCalendarDate(tz);
            date.setNormalizedDate(y, m, d).setTimeOfDay(hh, mm, ss, ms);
            fastTime = ncal.getTime(date);
        }
        return date;
    }
View Full Code Here

TOP

Related Classes of sun.util.calendar.BaseCalendar

Copyright © 2018 www.massapicom. 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.