List of utility methods to do Date to String
String | Date2StringSec(Date date) Date String Sec SimpleDateFormat formatter = new SimpleDateFormat(DefaultLongFormat); return formatter.format(date); |
String | datetime(Date date) datetime return formatter.format(date);
|
String | dateTime2String(Date dateTime, DateFormat dateFormat) date Time String if (dateTime == null) return null; return dateFormat.format(dateTime); |
String | dateTimeISO(final java.util.Date date) Returns the given date as an ISO date and time string ( "YYYY-MM-DD HH:MM:SS" ) if (date != null) { SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_TIME_ISO_FORMAT); return dateFormat.format(date); } else { return ""; |
Date | dateTimeToZero(Date date) date Time To Zero if (date == null) { return null; return strToDtSimpleFormat(dateFormat(date)); |
String | dateTo14String(Date date) date To String if (date == null) { return null; java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("yyyyMMddHHmmss"); return dateFormat.format(date); |
String | dateToBOMCStrDate(Date date) date To BOMC Str Date try { SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String s = simpledateformat.format(date); s = StrToBOMCStrDate(s); return s; } catch (Exception e) { return ""; |
Calendar | dateToCalendar(Date fecha, String formato) date To Calendar try { if (nullToBlank(fecha).equals("")) { return null; SimpleDateFormat df = new SimpleDateFormat(formato); String text = df.format(fecha); return stringToCalendar(text, formato); } catch (Exception e) { ... |
String | dateToDateString(Date date, Locale locale) convert a java date to a string of type "yyyy-mm-dd hh:mm:ss" if (locale == null) locale = Locale.ITALIAN; String t = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale).format(date); String[] tmptime = t.split("\\."); String d = DateFormat.getDateInstance(DateFormat.SHORT, locale).format(date); String[] tmpdate = d.split("/"); String hour = tmptime[0].trim(); if (hour.length() == 1) { ... |
String | dateToDDMMYYYYStr(Date dateTime) date To DDMMYYYY Str SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_DDMMYYYY_FORMAT); return simpleDateFormat.format(dateTime); |