List of utility methods to do Date Format
String | formatDate(Date date) format Date return DATE_FORMAT.format(date);
|
String | now(String dateFormat) Returns the current date in a given format. SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); long now = System.currentTimeMillis(); return sdf.format(new Date(now)); |
String | now(String dateFormat) now Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); return sdf.format(cal.getTime()); |
String | getLongFriendlyDate(Date dt) get Long Friendly Date String dtStr = DateFormat.format("MMM d, yyyy", dt).toString(); Date today = getToday(); String todayStr = DateFormat.format("MMM d, yyyy", today) .toString(); if (dtStr.equals(todayStr)) { return "Today " + DateFormat.format("h:mm aa", dt); Date yesterday = getYesterday(); ... |
String | getMainClockString(Date utcDate) get Main Clock String if (utcDate.getTime() == 0) { return ""; SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA); return sdf.format(utcDate.getTime()); |
String | currentDateToString(String format) current Date To String SimpleDateFormat formatter = new SimpleDateFormat(format); Date currentDate = new Date(System.currentTimeMillis()); return formatter.format(currentDate); |
String | dateToString(Date paramDate, String paramString) date To String SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat( paramString, Locale.FRANCE); localSimpleDateFormat.setTimeZone(TimeZone .getTimeZone("Europe/Paris")); return localSimpleDateFormat.format(paramDate); |
String | changeDateToFormatString(Date fecha, String pattern) change Date To Format String DateFormat formato = new SimpleDateFormat(pattern); return formato.format(fecha); |
String | createName(String format, long dateTaken) create Name Date date = new Date(dateTaken); SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); |
String | formatDate(Date d) Formats the input date to string. return d != null ? DateFormat.getDateInstance().format(d) : ""; |