Here you can find the source of format(long time)
public static String format(long time)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String format(Date date) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return simpleDateFormat.format(date); }/* ww w . jav a2 s.c o m*/ public static String format(long time) { SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return simpleDateFormat.format(new Date(time)); } }