List of utility methods to do Date Format
Date | dateFormatCheck(String source, String format) date Format Check if (source == null) { throw new ParseException("date string to check is null", 0); if (format == null) { throw new ParseException("format string to check date is null", 0); SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.KOREA); Date date = null; ... |
String | dateformate(String reg, Date newdate) dateformate if (!reg.equals(REG)) { REG = reg; simpleDateFormat = new SimpleDateFormat(REG); return simpleDateFormat.format(newdate); |
Date | dateFormater(String dataStr, String dataFormat) date Formater DateFormat dateFormat = new SimpleDateFormat(dataFormat, Locale.ENGLISH); Date date = null; try { date = dateFormat.parse(dataStr); } catch (ParseException e) { e.printStackTrace(); return date; ... |
String | dateFormatString(Date date) date Format String return getDate2Str(DATE_FORMAT_1, date);
|
String | dateFormatted(Date date) Returns the date with the format yyyy/MM/dd HH:mm:ss. String result = ""; if (date != null) { result = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss").format(date); return result; |
SimpleDateFormat | dateFormatter(String dateFormat) date Formatter return new SimpleDateFormat(dateFormat); |
String | dateFormatTime(final Date date) Formats a Date to the application wide format for time SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT); return sdf.format(date); |
String | dateFormatToString(Date date, String format) date Format To String if (date == null) { return null; SimpleDateFormat sdf = new SimpleDateFormat(format); try { return sdf.format(date); } catch (Exception e) { e.printStackTrace(); ... |
String | dateFormatToString(String source, String format) date Format To String if (source == null || "".equals(source)) return null; SimpleDateFormat dateFormat = new SimpleDateFormat(format); dateFormat.setLenient(false); return dateFormat.format(source); |
DateFormat | dateFormatUTC() date Format UTC DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); df.setTimeZone(TimeZone.getTimeZone("UTC")); return df; |