Date is send in jsonserialised format i.e Date(1542002443000) from server.How can I convert to dd-mm-yyyy HH:mm:ss aa in android? I had already converted this type of format 2018-11-12T10:16:43 by this code.
Code:
public static String DateAndTimeCustom(String input) {
String date = input.substring(0, input.indexOf("T"));
String time = input.substring(input.indexOf("T") + 1, input.length());
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy", Locale.ENGLISH);
Date formattedDate = null;
try {
DateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH);
formattedDate = format.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return df.format(formattedDate) + " " + time;
}
How can i convert this Date(1542002443000)?