Java Utililty Methods Date Now

List of utility methods to do Date Now

Description

The list of methods to do Date Now are organized into topic(s).

Method

StringgetNowDate(String format)
get Now Date
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date date = new Date();
return sdf.format(date);
DategetNowDateShort()
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;
StringgetNowDateStr(String formatStr)
get Now Date Str
SimpleDateFormat format = new SimpleDateFormat(formatStr);
return format.format(getNowDate());
StringgetNowDateString(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();