Here you can find the source of convertDate(long timestamp)
public static String convertDate(long timestamp)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String convertDate(long timestamp) { return new SimpleDateFormat("yyyy-MM-dd").format(new Date(timestamp)); }/*from ww w . ja va 2s .c o m*/ public static String format(Date date) { return format(date, "yyyy-MM-dd HH:mm:ss"); } public static String format(Date date, String pattern) { return new SimpleDateFormat(pattern).format(date); } }