Here is the code for how to converting any milliseconds to date.
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class ConvertMiliSecondToDate {
public static void main(String[] args) {
long milliSeconds = 1384275600000L; //Enter any value
// change the date format as per your requirement
DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(milliSeconds);
System.out.println(formatter.format(calendar.getTime()));
}
}
The Output should be : 13/11/2013 18:45:30
Happy Learning!!
No comments :
Post a Comment