Convert milliseconds to a readable date in Java

This is a simple code snippet that converts milliseconds to a dateformat that is more understandable by humans. import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static void main(String[] args) { long ms = 1359256734; Date date = new Date(ms); SimpleDateFormat dateformat = new SimpleDateFormat("MMM dd, yyyy HH:mm"); System.out.println(dateformat.format(date)); } } The millisecond date is parsed into a Date object, and then printed at a specific format given by the SimpleDateFormat object. For

» Read more