date_2 = ref.parse(datestr_2);
} catch ( ParseException e ) {
errln("parse exception" + e);
continue;
}
DateInterval dtitv = new DateInterval(date.getTime(),
date_2.getTime());
DateIntervalFormat dtitvfmt = DateIntervalFormat.getInstance("yyyyMMMdd", loc);
//DateIntervalFormat dtitvfmt = DateIntervalFormat.getInstance("yMd");
//SimpleDateFormat dtfmt = new SimpleDateFormat("yyyy 'year' MMM 'month' dd 'day'", loc);
//dtitvfmt.setDateFormat(dtfmt);
DateIntervalInfo dtitvinf = new DateIntervalInfo();
dtitvinf.setFallbackIntervalPattern("{0} --- {1}");
dtitvinf.setIntervalPattern("yMMMd", Calendar.YEAR, "'all diff'");
dtitvinf.setIntervalPattern("yMMMd", Calendar.MONTH, "yyyy 'diff' MMM d - MMM y");
dtitvinf.setIntervalPattern("yMMMd", Calendar.DATE, "yyyy MMM d ~ d");
dtitvinf.setIntervalPattern("yMMMd", Calendar.HOUR_OF_DAY, "yyyy MMMd HH:mm ~ HH:mm");
dtitvfmt.setDateIntervalInfo(dtitvinf);
FieldPosition pos = new FieldPosition(0);
StringBuffer str = new StringBuffer("");
DateFormat dtfmt = dtitvfmt.getDateFormat();
Calendar fromCalendar = (Calendar) dtfmt.getCalendar().clone();
Calendar toCalendar = (Calendar) dtfmt.getCalendar().clone();
fromCalendar.setTimeInMillis(dtitv.getFromDate());
toCalendar.setTimeInMillis(dtitv.getToDate());
dtitvfmt.format(fromCalendar, toCalendar, str, pos);
String expected = data[i++];
String formatted = dtitvfmt.format(dtitv).toString();
if ( !formatted.equals(Utility.unescape(expected)) ) {