Java tutorial
//package com.java2s; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static String getDateFromCal(String pattern, Calendar cal) { DateFormat df = new SimpleDateFormat(pattern, Locale.getDefault()); return df.format(cal.getTime()); } }