Here you can find the source of calendarToString(Calendar c)
public static String calendarToString(Calendar c)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String calendarToString(Calendar c, String pattern) { if (c != null) { SimpleDateFormat format = new SimpleDateFormat(pattern); return format.format(c.getTime()); }/* www.jav a 2s .co m*/ return null; } public static String calendarToString(Calendar c) { return calendarToString(c, "yyyyMMddHHmmss"); } }