Here you can find the source of formatDateTd(Object obj)
public static String formatDateTd(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 formatDateTd(Object obj) { String out = "<td style='text-align:center'>"; String strDate = formatDate(obj); if (strDate.length() == 0) { out = (new StringBuilder()).append(out).append(" ").toString(); } else {/*from www .java 2 s . co m*/ out = (new StringBuilder()).append(out).append(strDate).toString(); } out = (new StringBuilder()).append(out).append("</td>").toString(); return out; } public static String formatDate(Object obj) { String out = ""; if (obj == null) { return out; } 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; } }