Here you can find the source of toDateFromLong(Long time)
public static Date toDateFromLong(Long time)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date toDateFromLong(Long time) { try {//w w w.j a v a2 s.c om SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String str = formatter.format(time); Date date = formatter.parse(str); return date; } catch (ParseException e) { e.printStackTrace(); return null; } } }