public IValue printDateTimeInLocale(IDateTime inputDateTime, IString formatString, IString locale)
//@doc{Print an input datetime using a specific locale and format string}
{
try {
SimpleDateFormat sd = new SimpleDateFormat(formatString.getValue(),new ULocale(locale.getValue()));
Calendar cal = getCalendarForDateTime(inputDateTime);
sd.setCalendar(cal);
return values.string(sd.format(cal.getTime()));
} catch (IllegalArgumentException iae) {
throw RuntimeExceptionFactory.dateTimePrintingError("Cannot print datetime using format string: " + formatString.getValue() +
" in locale: " + locale.getValue(), null, null);
}
}