How to Format this Date “2018-08-02T00:00:00+05:30” String to this “2018-18-02”

public static String getDateUsingOracleFormat(String date) {
try {


DateFormat inputFormat = new SimpleDateFormat("YYYY-MM-dd'T'HH:mm:ss");
Date date2 = inputFormat.parse(date);
SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd");
String outputText = sdf.format(date2);

return outputText;
} catch (Exception e) {

e.printStackTrace();
return e.toString();
}
}

Post a Comment

Previous Post Next Post