Hello Experts,
I would like to get your opinion/comments on the performance issues with respect to speed of execution when using graphical functions for doing the date conversion requirement given below:
Requirement is to convert input date u20182008-12-03u2019 from the source side to u201820081203u2019 on the target side.
We have used the standard graphical mapping functions 'substring' & 'replacestring' for doing this conversion as explained here: The u2018substringu2018 function is used to capture the part of the string from the source. A u2018constantu2019 with value u2018u2013u2018 is replaced by u2018constantu2019 (empty value) by using the standard text function u2018replaceStringu2019 in the target side.
We did the same using the following UDF too:
public String convertDate(String dateStringInOriginalFormat) {
SimpleDateFormat originalFormatter = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat newFormatter = new SimpleDateFormat("yyyyMMdd");
ParsePosition pos = new ParsePosition(0);
Date dateFromString = originalFormatter.parse(
dateStringInOriginalFormat, pos);
String dateStringInNewFormat = newFormatter.format(dateFromString);
return dateStringInNewFormat;
}
From a critical performance point of view, which approach will fare better?
Thanks in Advance,
Earnest A Thomas
Edited by: Earnest Thomas on Dec 4, 2008 6:54 AM