Java tutorial
//package com.java2s; //License from project: LGPL import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String timeToDateString(String time) { SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = ""; try { date = simpleFormat.format(new Date(Long.parseLong(time))); } catch (Exception e) { e.printStackTrace(); } return date; } public static String timeToDateString(Long time) { SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String date = simpleFormat.format(new Date(time)); return date; } public static String timeToDateString(Long time, String formatter) { SimpleDateFormat simpleFormat = new SimpleDateFormat(formatter); String date = simpleFormat.format(new Date(time)); return date; } }