Here you can find the source of format(Calendar calendar)
public static synchronized String format(Calendar calendar)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { private static final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy - HH:mm:ss"); public static synchronized String format(Date date) { if (date == null) { return null; }/*ww w . ja v a 2s .co m*/ return dateFormat.format(date); } public static synchronized String format(Calendar calendar) { if (calendar == null) { return null; } return dateFormat.format(calendar.getTime()); } }