Here you can find the source of parseTime(long time, String pattern)
public static String parseTime(long time, String pattern)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static String parseTime(long time, String pattern) { Date date = new Date(time); if (isBlank(pattern)) { pattern = "yyyy-MM-dd HH:mm"; }/*ww w . j av a2 s. c o m*/ SimpleDateFormat dateFormat = new SimpleDateFormat(pattern, Locale.getDefault()); return dateFormat.format(date); } public static boolean isBlank(String s) { if (s == null || "".equals(s.trim())) { return true; } return false; } }