Here you can find the source of formatCalendar(Calendar objCal, String strFormat)
public static String formatCalendar(Calendar objCal, String strFormat)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String formatCalendar(Calendar objCal, String strFormat) { if (objCal == null) { return null; } else {/*from w w w .ja v a 2 s . co m*/ SimpleDateFormat formatter = new SimpleDateFormat(strFormat); return formatter.format(objCal.getTime()); } } }