Here you can find the source of dateToString(Calendar date, DateFormat format)
public static String dateToString(Calendar date, DateFormat format)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static final DateFormat FORMAT_DATE = new SimpleDateFormat("dd/MM/yyyy"); public static String dateToString(Calendar date) { return dateToString(date, FORMAT_DATE); }/*w w w . ja v a 2 s . c om*/ public static String dateToString(Calendar date, DateFormat format) { if (date == null) return null; return format.format(date.getTime()); } }