Here you can find the source of formatMillis(String millisecond, String format)
public static String formatMillis(String millisecond, String format)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static String formatMillis(String millisecond, String format) { Date date;/*from w w w . j av a 2 s . c o m*/ if (format == null || "".equals(format)) { format = "yyyy-MM-dd HH:mm:ss"; } SimpleDateFormat sdf = new SimpleDateFormat(format); if (millisecond != null && millisecond.matches("\\d+")) { date = new Date(Long.parseLong(millisecond)); return sdf.format(date); } return ""; } }