List of utility methods to do Time Now
Date | getNowTime() get Now Time SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); String dateStr = dateFormat(date); try { date = format.parse(dateStr); } catch (ParseException e) { e.printStackTrace(); return date; |
String | getNowTime() yyyy-MM-dd HH:mm:ss return allDateFmt.format(new Date()); |
String | getNowTime(String format) get Now Time Date nowDate = new Date(); Calendar now = Calendar.getInstance(); now.setTime(nowDate); SimpleDateFormat formatter = new SimpleDateFormat(format); return formatter.format(now.getTime()); |
String | getNowTime(String format, Locale loc) get Now Time if (format == null) { format = "yyyy-MM-dd HH:mm:ss"; if (loc == null) return new java.text.SimpleDateFormat(format).format(java.util.Calendar.getInstance().getTime()); return new java.text.SimpleDateFormat(format, loc).format(java.util.Calendar.getInstance().getTime()); |
String | getNowTime(String formatStr) get Now Time return new SimpleDateFormat(formatStr).format(new Date()); |
String | getNowWithLocal(boolean ifdatetime) get current date by local pattern java.util.Date dd = new java.util.Date(); if (ifdatetime) { return java.text.DateFormat.getDateTimeInstance(java.text.DateFormat.LONG, java.text.DateFormat.LONG) .format(dd); } else { return java.text.DateFormat.getDateInstance(java.text.DateFormat.LONG).format(dd); |
int | getNowYearMonth() get Now Year Month String returnStr = null; SimpleDateFormat f = new SimpleDateFormat("yyyyMM"); Date date = new Date(); returnStr = f.format(date); return Integer.parseInt(returnStr); |
String | getNowYMD() get Now YMD String str = now();
return str.substring(0, 10);
|
Date | getSpecifiedDateTime_235959(Date curDate) get Specified Date Tim_ return getSpecifiedDateTimeBySeconds(getFormatDateToDate(curDate), 24 * 60 * 60 - 1);
|
String | getStrCurrentStrTime() get Str Current Str Time return getCurrentStrTime("yyyyMMddHHmmss"); |