Here you can find the source of format(Calendar cal)
Parameter | Description |
---|---|
cal | the Calendar |
public static String format(Calendar cal)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); /**//from w ww .j a v a 2 s. c o m * Null-safe method to display a {@link Calendar} as a formatted {@link String}. * <p/> * Format template is {@code yyyy-MM-dd'T'HH:mm:ss}. * * @param cal the {@link Calendar} * @return the formatted {@link String} */ public static String format(Calendar cal) { return cal == null ? "null" : "<" + df.format(cal.getTime()) + ">"; } }