List of utility methods to do Date to String Convert
String | convertToDateStamp(Date date) Convert given date to string OutputFormat: yyyymmdd_hhmm Calendar cal = Calendar.getInstance();
cal.setTime(date);
return convertToDateStamp(cal);
|
String | dateTimeToString(Date date) date Time To String if (date != null) { return (formatter.format(date)); } else return ""; |
String | dateToIsoDateString(@NotNull Date date) Converts a Date object to an ISO-formatted String representation of it. return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(date); |
String | dateToIsoDateString(@Nullable Date date, @NotNull DateFallback fallback) Converts a java.util.Date object to an ISO-formatted String representation of it. if (date != null) { return new SimpleDateFormat("yyyy-MM-dd HH:mm").format(date); } else if (fallback == DateFallback.EARLIEST) { return getEarliestDateString(); throw new IllegalArgumentException( "date is null and fallback parameter is invalid!"); |
String | formatDate(Date date, String format) Formats date to the string with specific time date format. return new SimpleDateFormat(format).format(date); |
String | formatDate(String format, Date date) format Date return new SimpleDateFormat(format, ConfigurationManager .getInstance().getCurrentLocale()).format(date); |
String | formatDate(final Date date) format Date SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss"); return sdf.format(date); |
String | getCurrentDateStr() get Current Date Str SimpleDateFormat dateFormat = new SimpleDateFormat(ONLY_DATE_FORMAT); Date d = new Date(System.currentTimeMillis()); return dateFormat.format(d); |
String | getCurrentDateStrs() get Current Date Strs SimpleDateFormat dateFormat = new SimpleDateFormat( ONLY_DATE_FORMAT_s); Date d = new Date(System.currentTimeMillis()); return dateFormat.format(d); |
String | getCurrentTimeStr() get Current Time Str SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); Date d = new Date(System.currentTimeMillis()); return dateFormat.format(d); |