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

StringgetCurrentDateStr()
get Current Date Str
return formatDate(new Date());
StringgetCurrentDateStr()
get Current Date Str
Date now = new Date();
return yyyyMmDd.format(now);
StringgetCurrentDateStr(String pattern)
get Current Date Str
return getDateString(new Date(), pattern);
StringgetCurrentDateString()
get Current Date String
return dateToString(getCurrentDateTime(), ISO_EXPANDED_DATE_FORMAT);
StringgetCurrentDateString()
get Current Date String
Date date = new Date(); 
return formatDate(DDMMYYHHMMSS, date);
StringgetCurrentDateString()
Returns the current date in string form.
return formatDateTime(Calendar.getInstance().getTime());
StringgetCurrentDateString(String dateFormat)
get Current Date String
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
sdf.setTimeZone(TimeZone.getDefault());
return sdf.format(cal.getTime());
StringgetCurrentDateString(String format)
get Current Date String
Date time = GregorianCalendar.getInstance().getTime();
return new SimpleDateFormat(format).format(time);
StringgetCurrentDateTime()
Returns the current date formatted for the UI
return toUIDateTimeString(new Date());
StringgetCurrentDateTime()
get Current Date Time
DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(System.currentTimeMillis());
return formatter.format(calendar.getTime());