@Override public Calendar getCalendar() { return CalendarICU.wrap(fIcuSdf.getCalendar()); }
private DateIntervalFormat(String skeleton, ULocale locale, SimpleDateFormat simpleDateFormat) { fDateFormat = simpleDateFormat; fSkeleton = skeleton; fInfo = new DateIntervalInfo(locale).freeze(); isDateIntervalInfoDefault = true; fFromCalendar = (Calendar) fDateFormat.getCalendar().clone(); fToCalendar = (Calendar) fDateFormat.getCalendar().clone(); initializePattern(LOCAL_PATTERN_CACHE); }
/** * Construct a DateIntervalFormat from DateFormat, * a DateIntervalInfo, and skeleton. * DateFormat provides the timezone, calendar, * full pattern, and date format symbols information. * It should be a SimpleDateFormat object which * has a pattern in it. * the DateIntervalInfo provides the interval patterns. * * @param skeleton the skeleton of the date formatter * @param dtItvInfo the DateIntervalInfo object to be adopted. * @param simpleDateFormat will be used for formatting * * @internal * @deprecated This API is ICU internal only. */ @Deprecated public DateIntervalFormat(String skeleton, DateIntervalInfo dtItvInfo, SimpleDateFormat simpleDateFormat) { fDateFormat = simpleDateFormat; // freeze date interval info dtItvInfo.freeze(); fSkeleton = skeleton; fInfo = dtItvInfo; isDateIntervalInfoDefault = false; fFromCalendar = (Calendar) fDateFormat.getCalendar().clone(); fToCalendar = (Calendar) fDateFormat.getCalendar().clone(); initializePattern(null); }
private DateFormat createDateFormat() { ULocale locale = ULocale.forLanguageTag(this.locale); // calendar and numberingSystem are already handled in language-tag // assert locale.getKeywordValue("calendar").equals(calendar); // assert locale.getKeywordValue("numbers").equals(numberingSystem); SimpleDateFormat dateFormat = new SimpleDateFormat(pattern.get(), locale); if (timeZone != null) { dateFormat.setTimeZone(TimeZone.getTimeZone(timeZone)); } Calendar calendar = dateFormat.getCalendar(); if (calendar instanceof GregorianCalendar) { // format uses a proleptic Gregorian calendar with no year 0 GregorianCalendar gregorian = (GregorianCalendar) calendar; gregorian.setGregorianChange(new Date(Long.MIN_VALUE)); } return dateFormat; }
if (newFormatSymbols instanceof DateFormatSymbolsICU) { icuDfs = ((DateFormatSymbolsICU)newFormatSymbols).unwrap(); } else if (fIcuSdf.getCalendar() instanceof com.ibm.icu.util.GregorianCalendar) {