Here you can find the source of format(Calendar calendar)
Parameter | Description |
---|---|
calendar | a parameter |
public static String format(Calendar calendar)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /**//from ww w . j a v a 2 s. c o m * format a calendar using {@link SimpleDateFormat}, with default pattern. * if a null calendar is passed in, empty string is returned. * * @param calendar * @return */ public static String format(Calendar calendar) { String formatted = ""; if (calendar != null) { formatted = new SimpleDateFormat().format(calendar.getTime()); } return formatted; } }