Here you can find the source of formatDate(Date date)
Parameter | Description |
---|---|
date | date |
public static String formatDate(Date date)
//package com.java2s; import java.text.DateFormat; import java.text.Format; import java.util.Date; public class Main { private static ThreadLocal<Format> DATE_FORMAT = new ThreadLocal<Format>() { @Override/*from w w w . j a v a 2 s .c om*/ protected Format initialValue() { return DateFormat.getDateInstance(); } }; /** * Convenience method for converting {@link Date} to a string * representation with minimal overhead. * * <p> * Intended for use in KRAD SpEL expressions, for example: * </p> * * <pre> * @{T(org.kuali.ole.krad.OleComponentUtils).formatDate(aDate)} * </pre> * * @param date date * @return formatted date string */ public static String formatDate(Date date) { return date == null ? "" : DATE_FORMAT.get().format(date); } }