Here you can find the source of formatDateTd(Object obj)
public static String formatDateTd(Object obj)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; public class Main { public static String formatDateTd(Object obj) { String out = "<td style='text-align:center'>"; String strDate = formatDate(obj); if (strDate.length() == 0) { // if you don't put a "non-breaking space" in an empty td/cell, // the cell's border doesn't show ! out += " "; } else {// ww w . ja v a2 s .co m out += strDate; } out += "</td>"; return out; } public static String formatDate(Object obj) { if (obj == null) { return ""; } try { java.util.Date dateval = (java.util.Date) obj; SimpleDateFormat dateformat = new SimpleDateFormat("MM/dd/yyyy"); dateformat.setLenient(false); return dateformat.format(dateval); } catch (Exception e) { return "bad date in FormatUtils.formatDate: " + obj.toString() + " error: " + e.getMessage(); } } }