Android examples for java.util:Calendar
Format Calendar by format passed in
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main{ public static String getFormatedDate(Calendar c, String format) { try {/*from w ww.j a v a2s . co m*/ Date d = new Date(c.getTimeInMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(d); } catch (Exception e) { return new String(); } } }