Here you can find the source of getFormatedDate(Calendar c, String format)
public static String getFormatedDate(Calendar c, String format)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String getFormatedDate(Calendar c, String format) { try {/*www . j a v a 2 s . co m*/ Date d = new Date(c.getTimeInMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(d); } catch (Exception e) { return new String(); } } }