Here you can find the source of formatDate(Object obj)
public static String formatDate(Object obj)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.sql.Date; public class Main { public static String formatDate(Object obj) { String out = ""; if (obj == null) { return out; }//from w w w . j av a2 s. c o m try { Date dateval = (Date) obj; if (dateval != null) { SimpleDateFormat dateformat = new SimpleDateFormat("MM/dd/yyyy"); dateformat.setLenient(false); out = dateformat.format(dateval); } } catch (Exception e) { out = (new StringBuilder()).append("bad date in FormatUtils.formatDate: ").append(obj.toString()) .append(" error: ").append(e.getMessage()).toString(); } return out; } }