Here you can find the source of formatDate(Date date)
public final static String formatDate(Date date) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String formatDate(Date date) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); if (date != null) { return sdf.format(date); }//from ww w . j a v a2s . c o m return ""; } }