List of utility methods to do Date Now
String | getCurrentDate(String format) get Current Date if (format == null || format.isEmpty()) format = "yyyy.MM.dd'-'HH:mm:ss"; java.text.DateFormat dateFormat = new java.text.SimpleDateFormat(format); java.util.Date date = new java.util.Date(); String currDate = dateFormat.format(date); return currDate; |
String | getCurrentDate(String formatStr) get Current Date if ("mm/dd/yyyy".equals(formatStr)) { formatStr = DISPLAY_DATE_FORMAT; SimpleDateFormat formatter = new SimpleDateFormat(formatStr); Date currentDate = new Date(); return formatter.format(currentDate); |
String | getCurrentDate(String pattern) get Current Date SimpleDateFormat datePattern = null; if (null == pattern || "".equals(pattern)) { datePattern = new SimpleDateFormat("yyyyMMdd"); } else { datePattern = new SimpleDateFormat(pattern); return datePattern.format(new Date()); |
String | getCurrentDate(String pattern) get Current Date String result; SimpleDateFormat formatter = new SimpleDateFormat(pattern); result = formatter.format(new Date()); return result; |
String | getCurrentDate(String pattern) Formats the current date into a string according to a specified pattern. return formatDate(pattern, new Date()); |
String | getCurrentDate(String pattern, Locale locale) get Current Date return getDate(new Date(), pattern, locale); |
String | getCurrentDate2(String format) get Current Date Date dateNow = Calendar.getInstance(new SimpleTimeZone(9 * 60 * 60 * 1000, "KST")).getTime(); SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.getDefault()); return formatter.format(dateNow); |
String | getCurrentDate_String() get Current Dat String return dateToString(now(), DF_YMD);
|
String | getCurrentDate_YYYY_MM_DD() Here get the current date in format 'YYYY-MM-DD' Calendar cal = Calendar.getInstance(TimeZone.getDefault()); final String dateFormat = "yyyy-MM-dd"; java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(dateFormat); sdf.setTimeZone(TimeZone.getDefault()); return sdf.format(cal.getTime()); |
String | getCurrentDateAllformated() get Current Date Allformated Locale loc = new Locale("zh", "CN"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", loc); return sdf.format(new Date()); |