Here you can find the source of formatDate(long timeInMillis)
public static String formatDate(long timeInMillis)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static final String DATE_FORMAT = "yyyy-MM-dd"; public static String formatDate(long timeInMillis) { return format(DATE_FORMAT, timeInMillis); }/*ww w . jav a 2s . c om*/ private static String format(String pattern, long timeInMillis) { final SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(new Date(timeInMillis)); } }