Long转换为date
public static void main(String[] args) { Long time = System.currentTimeMillis(); System.out.println(time); System.out.println(transferLongToDate("yyyy-MM-dd HH:mm:ss",time)); } private static String transferLongToDate(String dateFormat, Long millSec) { SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); Date date = new Date(millSec); return sdf.format(date); }