Hi,
I have a below method.
The input to this method comes from file. What happens is if the input is say 20083030, then it is conveting to 06/30/2010. Which is not right. Is there any alternative to fix this issue.
public static
String getFormattedDate(String s) {
String retDate = null;
if(s == null || s.equalsIgnoreCase(""))
return retDate;
if(s.startsWith("*"))
return s;
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");
SimpleDateFormat format1 = new SimpleDateFormat("yyyyMMdd");
try {
Date dt = format1.parse(s);
retDate = format.format(dt);
} catch (ParseException e) {
e.printStackTrace();
}
Thanks
return retDate;
}