Here you can find the source of toShort(Calendar calendar)
public static String toShort(Calendar calendar)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static String toShort(Calendar calendar) { return DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(calendar.getTime()); }//from w w w. j av a 2 s. 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()); } }