Example
formateDateFromstringUpdated("yyyy-MM-dd HH:mm:ss", "M/d/yyyy hh:mm aa", "2015-01-15 06:30:00");
public static String formateDateFromstringUpdated(String inputFormat, String outputFormat, String inputDate){
Date parsed = null;
String outputDate = inputFormat;
SimpleDateFormat df_input = new SimpleDateFormat(inputFormat, java.util.Locale.getDefault());
SimpleDateFormat df_output = new SimpleDateFormat(outputFormat, java.util.Locale.getDefault());
try {
parsed = df_input.parse(inputDate);
outputDate = df_output.format(parsed);
} catch (ParseException e) {
Log.e("Date Formatting ", "ParseException - dateFormat");
}
return outputDate;
}
No comments:
Post a Comment