else {
patternLength = DateFormat.FULL;
}
if (lcPattern.endsWith("datetime")) {
return new TextualDateFormat(locale, DateFormat.getDateTimeInstance(patternLength, patternLength, locale));
}
else if (lcPattern.endsWith("time")) {
return new TextualDateFormat(locale, DateFormat.getTimeInstance(patternLength, locale));
}
else {
return new TextualDateFormat(locale, DateFormat.getDateInstance(patternLength, locale));
}
}
// For custom patterns
SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, locale);
dateFormat.setLenient(false);
return new TextualDateFormat(locale, dateFormat);
}