List of utility methods to do Date Now
String | getNowDate(String format) get Now Date SimpleDateFormat sdf = new SimpleDateFormat(format); Date date = new Date(); return sdf.format(date); |
Date | getNowDateShort() get Now Date Short Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String dateString = formatter.format(currentTime); ParsePosition pos = new ParsePosition(8); Date currentTime_2 = formatter.parse(dateString, pos); return currentTime_2; |
String | getNowDateStr(String formatStr) get Now Date Str SimpleDateFormat format = new SimpleDateFormat(formatStr); return format.format(getNowDate()); |
String | getNowDateString(String sign) get Now Date String SimpleDateFormat formatter; formatter = new SimpleDateFormat("yyyy" + sign + "MM" + sign + "dd"); String dateString = formatter.format(new Date()); return dateString.trim(); |