Here you can find the source of formatDate(Calendar c)
public static String formatDate(Calendar c)
//package com.java2s; import java.util.*; import java.text.SimpleDateFormat; public class Main { private static String DATE_FORMAT = "dd/MM/yy HH:mm:ss"; public static String formatDate(Calendar c) { if (c == null) return null; SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); return df.format(c.getTime()); }/*from w w w. jav a 2 s. c o m*/ public static String formatDate(Date c) { if (c == null) return null; SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); return df.format(c); } }