Here you can find the source of getString(Calendar calendar)
Parameter | Description |
---|---|
calendar | a parameter |
public static String getString(Calendar calendar)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /**//from w w w.jav a 2 s. com * Pattern default. */ private static final String PATTERN_DEFAULT = "yyyy-MM-dd HH:mm:ss"; /** * Return {@link String} object from {@link Calendar} @param calendar. * Use default pattern {@link #PATTERN_DEFAULT} * @param calendar * @return */ public static String getString(Calendar calendar) { return getString(PATTERN_DEFAULT, calendar); } /** * Return {@link String} object from {@link Calendar} @param calendar. * @param pattern Pattern to use in conversion. * @param calendar * @return */ public static String getString(String pattern, Calendar calendar) { SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(calendar.getTime()); } }