List of utility methods to do Date Format
Date | dateformat(String dateTime) dateformat SimpleDateFormat formatter = null; int dot = dateTime.indexOf('.'); int col = dateTime.indexOf(':'); if (col > 0) { if (dot > 0) { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"); } else { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); ... |
String | dateFormat(String datetime) date Format SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM"); Date date = null; try { date = sdf.parse(datetime); } catch (ParseException e) { e.printStackTrace(); Calendar cl = Calendar.getInstance(); ... |
SimpleDateFormat | dateFormat(String df, TimeZone timeZone) date Format SimpleDateFormat ret = new SimpleDateFormat(df); ret.setTimeZone(timeZone); return ret; |
String | dateFormat(String format, java.util.Date date) date Format return dateFormat(format, date, null, null);
|
String | dateFormat(String format, java.util.Date date, String tz, Locale locale) date Format if (date == null) { return null; if (format == null) { for (int i = 0; i < tsDefaultFormats.length; i++) { String dFormat = tsDefaultFormats[i]; try { String df = dateFormat(dFormat, date, tz, locale); ... |
String | dateFormat(String format, String defaultFormat) date Format if (format != null && !format.trim().isEmpty()) { format = format.trim(); if (format.startsWith("fmt:")) { format = format.substring(4); format = format.replace("%Y", "yyyy"); format = format.replace("%y", "yy"); format = format.replace("%m", "MM"); format = format.replace("%d", "dd"); ... |
Date | dateformat(String text, String format) dateformat SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format); Date date = simpleDateFormat.parse(text); return date; |
String | dateFormat3(Date date) date Format if (date == null) { return null; } else { return sdf3.format(date); |
SimpleDateFormat | dateFormat4yyyyMMdd() date Formatyyyy M Mdd return new SimpleDateFormat("yyyy-MM-dd"); |
Date | dateFormatCheck(String source) date Format Check return dateFormatCheck(source, "yyyyMMdd"); |