List of utility methods to do yyyy
String | formatDate(final Date date, final String defaultValue) format Date if (date == null) { return defaultValue; return dateFormat.format(date); |
String | formatDate(String date) Format date. String invDt1[] = date.toString().split("-"); String invDt = invDt1[2] + "-" + invDt1[1] + "-" + invDt1[0]; System.out.println("<<<<date>>>> " + invDt); return invDt; |
Date | formatDate(String date) format Date DateFormat myDateFormat = new SimpleDateFormat(DATE_FORMAT); return myDateFormat.parse(date); |
Date | formatDate(String date) format Date try { return DEFAUALT_DATE_FORMAT.parse(date); } catch (ParseException e) { e.printStackTrace(); return null; |
String | formatDate(String inputDate) format Date SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(inputDateFormat); Date d = DATE_FORMAT.parse(inputDate); DATE_FORMAT.applyPattern(outputDateFormat); return DATE_FORMAT.format(d); |
String | formatDate2DateStr() Format the current date time to "yyyy-MM-dd" format string. return formatDate2DateStr(new Date()); |
String | formatDate2DateStr() Format the current date time to "yyyy-MM-dd" format string. return formatDate2DateStr(new Date()); |
String | formatDate2ShortStr(Date date) Format the given date time to "yyyyMMdd" format string. SimpleDateFormat s = new SimpleDateFormat("yyyyMMdd"); return s.format(date); |
String | formatDate2Str(Date date) format Date Str return (new SimpleDateFormat("yyyy-MM-dd").format(date)); |
String | formatDateAsShortDateLocalTime(Date moonDate, TimeZone tz) Useful date-to-string formatting which I found myself using a lot DateFormat sdf = SimpleDateFormat.getDateInstance(SHORT); sdf.setTimeZone(tz); ((SimpleDateFormat) sdf).applyPattern("yyyy-MM-dd"); return sdf.format(moonDate); |