Here you can find the source of format(Calendar calendar, String pattern)
Parameter | Description |
---|---|
calendar | a parameter |
pattern | a parameter |
public static String format(Calendar calendar, String pattern)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { /**/*from w w w . ja v a 2s. c o m*/ * Formats the given {@link Calendar} while considering the time zone * information. * * @param calendar * @param pattern * @return */ public static String format(Calendar calendar, String pattern) { return format(calendar, new SimpleDateFormat(pattern)); } /** * Formats the given {@link Calendar} while considering the time zone * information. * * @param calendar * @param dateFormat * @return */ public static String format(Calendar calendar, DateFormat dateFormat) { dateFormat.setTimeZone(calendar.getTimeZone()); return dateFormat.format(calendar.getTime()); } }