Here you can find the source of getDateString(String date)
public static String getDateString(String date)
//package com.java2s; //License from project: Apache License import java.sql.Timestamp; public class Main { public static String getDateString(String date) { if (date != null && date.length() > 10) date = date.substring(0, 10); return date; }//ww w . j av a2s . co m public static String getDateString(Timestamp date) { if (date == null) return null; String s = date.toString(); return s.substring(0, 10); } }