Convert Milliseconds to a Date Format in Java, like as below as M yyyy HH:mm:ss: SSS Z format.
Manohar Changed status to publish June 16, 2019
Use below snippet code convert milliseconds to a date format :
public Date convertMilliSecondsToDate(String milliSeconds,String dateFormat) {
long dateTimeInMilliSeconds = Long.parseLong(milliSeconds);
Calendar calendar=Calendar.getInstance();
calendar.setTimeInMillis(dateTimeInMilliSeconds);
DateFormat formatter = new SimpleDateFormat(dateFormat);
Date convertedDate=convertStrToDate(formatter.format(calendar.getTimeInMillis()),dateFormat);
return convertedDate;
}
Manohar Changed status to publish June 16, 2019