Hi
Use below UDF:
public void dateTransEnhance(String[] date, String sourceFormat, String[] targetFormat, ResultList result, Container container) throws StreamTransformationException{ for (int i = 0; i < date.length; i++) { SimpleDateFormat sourceDate = new SimpleDateFormat(sourceFormat[0]); SimpleDateFormat targetDate = new SimpleDateFormat(targetFormat[0]); try { Date d = sourceDate.parse(date[i]); result.addValue(targetDate.format(d)); } catch (ParseException e) { e.printStackTrace(); } } }
Test:
Regards,
Praveen.