List of utility methods to do Now
String | nowStr() Return a string representing the current time. SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss"); return format.format(new Date()); |
String | nowString(String pattern) now String return getDateFormat(pattern).format(new Date()); |
String | nowString(String pattern) Return the current date in the specified format Calendar cal = Calendar.getInstance();
Date currDate = cal.getTime();
return format(currDate, pattern);
|
String | nowTime(String formartStr) now Time String strDate = null; if ((formartStr != null) && (!"".equals(formartStr))) { SimpleDateFormat sdf = new SimpleDateFormat(formartStr); strDate = sdf.format(new Date()); return strDate; |
String | nowTime(String format) now Time return new SimpleDateFormat(format).format(new Date()); |
String | printNow() print Now return toString(currentDate());
|
String | stringDate(Date now) string Date SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return simpleDateFormat.format(now); |
String | subNow() sub Now return getNow().substring(0, 10);
|
String | toStr2(Date now) to Str String s = ""; try { s = dateFomat2.format(now); } catch (Exception e) { e.printStackTrace(); return s; |
String | toString(Date now) to String SimpleDateFormat formatTime = new SimpleDateFormat(PATNER_DEFAULT); if (now == null) return ""; return formatTime.format(now); |