/** Makes a combined data and time string in the format "MM/DD/YYYY HH:MM:SS" from a Date. If the seconds are 0 they are left off. * @param date The Date * @return A combined data and time string in the format "MM/DD/YYYY HH:MM:SS" where the seconds are left off if they are 0. */ public static String toDateTimeString(java.util.Date date) { if (date == null) return ""; String dateString = toDateString(date); String timeString = toTimeString(date); if (dateString != null && timeString != null) return dateString + " " + timeString; else return ""; }
/** Makes a combined data and time string in the format "MM/DD/YYYY HH:MM:SS" from a Date. If the seconds are 0 they are left off. * @param date The Date * @return A combined data and time string in the format "MM/DD/YYYY HH:MM:SS" where the seconds are left off if they are 0. */ public static String toDateTimeString(java.util.Date date) { if (date == null) return ""; String dateString = toDateString(date); String timeString = toTimeString(date); if (dateString != null && timeString != null) return dateString + " " + timeString; else return ""; }