Here you can find the source of getDateString(long time)
public static String getDateString(long time)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String getDateString(long time) { Calendar date = Calendar.getInstance(); time = time * 1000;/*from www .jav a 2 s .c o m*/ //long targetTime = time - TimeZone.getDefault().getRawOffset(); date.setTimeInMillis(time); SimpleDateFormat dateformat = new SimpleDateFormat( "yyyy-MM-dd HH:mm"); String dateString = dateformat.format(date.getTime()); return dateString; } }