Here you can find the source of long2Datestr(long time, String format)
public static String long2Datestr(long time, String format)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; public class Main { public static String long2Datestr(long time, String format) { if (format == null || format.trim().equals("")) format = "yyyy-MM-dd HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(time); }/* w w w .j a v a2s . c o m*/ }