Here you can find the source of timestampToString(Long timestamp, String formatStr)
public static String timestampToString(Long timestamp, String formatStr)
//package com.java2s; import java.text.SimpleDateFormat; public class Main { public static String timestampToString(Long timestamp, String formatStr) { if (timestamp == null) { return null; }/*from w w w. j a v a2 s .c om*/ SimpleDateFormat sdf = new SimpleDateFormat(formatStr); try { return sdf.format(timestamp); } catch (Exception e) { e.printStackTrace(); } return null; } }