I get a TIMESTAMP from an Oracle DB in this format: yyyy-MM-dd hh:mm:ss.SSS and would like to convert to a String like dd.MM.yyyy. I performed string operations and the result was correct as expected. Is this approach right or wrong? Or is it more efficient to use as a formatter? Do I have to use formatter if Oracle returns a different string in the future because of a different NLS_LANG setting?
String date = data.toString().substring(0,10).replace("-","."); // data is received from DB
String day = datum.substring(8,10);
String month = datum.substring(4,8);
String year = datum.substring(0,4);
String myDate = new StringBuilder().append(day).append(month).append(year).toString();