Here you can find the source of calendarToString(Calendar c, String format)
Parameter | Description |
---|---|
c | a parameter |
format | a parameter |
public static final String calendarToString(Calendar c, String format)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; public class Main { public static final String FORMAT_DATE = "yyyy-MM-dd"; /**//from w w w .ja v a 2 s.c om * Convert a calendar to String. * * @param c * @param format * @return String */ public static final String calendarToString(Calendar c, String format) { String rtn = null; if (c != null) { SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.FRANCE); rtn = sdf.format(c.getTime()); } return rtn; } /** * Convert a calendar to String. * * @param c * @return String */ public static final String calendarToString(Calendar c) { return calendarToString(c, FORMAT_DATE); } }