Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static String getDateString(long millitm) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(millitm); return (setZeroPad(cal.get(Calendar.YEAR)) + "/" + setZeroPad(cal.get(Calendar.MONTH)) + "/" + setZeroPad(cal.get(Calendar.DATE)) + " " + setZeroPad(cal.get(Calendar.HOUR_OF_DAY)) + ":" + setZeroPad(cal.get(Calendar.MINUTE)) + ":" + setZeroPad(cal.get(Calendar.SECOND))); } private static String setZeroPad(int value) { if (value < 10) { return "0" + Integer.toString(value); } return Integer.toString(value); } }