Here you can find the source of getShortFormat(Date date)
public static String getShortFormat(Date date)
import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; import java.util.TimeZone; public class Main{ public static final String LOCAL_SHORT_DATE_FORMAT = "yyyy-MM-dd"; public static String getShortFormat(Date date) { if (date == null) { return null; }/* ww w . j a va2 s . co m*/ return getFormatString(date, LOCAL_SHORT_DATE_FORMAT); } public static String getFormatString(Date date, String dateFormat) { if (date == null || StringUtil.isEmpty(dateFormat)) { return null; } return new SimpleDateFormat(dateFormat, Locale.ENGLISH) .format(date); } }