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

StringcurrentDate(int dateStyle)
Current date as formatted string representation.
DateFormat df = DateFormat.getDateInstance(dateStyle);
return df.format(new Date());
StringcurrentDate(String format)
current Date
SimpleDateFormat dateFormat = new SimpleDateFormat(isBlank(format) ? "yyyy-MM-dd HH:mm:ss" : format);
return dateFormat.format(new Date());
StringcurrentDate(String format, Locale locale)
current Date
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format, locale);
simpleDateFormat.setLenient(false);
return simpleDateFormat.format(new Date());
StringcurrentDate(String format, String locale)
current Date
return formatDate(new Date(), format, locale);
StringcurrentDate2String()
current Date String
return date2String(new Date());
StringcurrentDate2String()
current Date String
return date2String(new Date());
StringcurrentDate_DDMMYY()
Speaking method for easier scripting.
return currentDate(DateFormat.SHORT);
StringcurrentDateAsString()
current Date As String
return toString(Calendar.getInstance());
StringcurrentDatePath(String basePath)
current Date Path
String backupTime = basePath + "/" + COMPACT_DATE_ID.format(new Date());
return backupTime;
StringcurrentDateStr()
current Date Str
return toDateString(new Date(), DEFAULT_FORMAT_DATE);