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

StringgetCurrentStringDate(String pattern)
get Current String Date
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat(pattern);
return formatter.format(currentTime);
StringgetCurrentStringDateYMD()
get Current String Date YMD
return getCurrentStringDate(PATTERN_YYYYMMDD);
StringgetCurrentStrTimeMills()
get Current Str Time Mills
return getCurrentStrTime("yyyy-MM-dd HH:mm:ss:SSS");
longgetCurrentTime()
get Current Time
try {
    return new java.text.SimpleDateFormat(FMT_LONG_TIME).parse(getCurrentDate(FMT_LONG_TIME)).getTime()
            / 1000;
} catch (Exception e) {
    e.printStackTrace();
return 0L;
longgetCurrentTime()
get Current Time
return (new Date()).getTime();
StringgetCurrentTime()
get Current Time
java.util.Calendar cal = java.util.Calendar.getInstance();
return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(cal.getTime());
StringgetCurrentTime()
get Current Time
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Date date = new Date(System.currentTimeMillis());
return sdf.format(date);
StringgetCurrentTime()
Returns current time in format of ISO8601:2000(YYYY-MM-DDTHH:MM:SS).
return df.format(new Date());
StringgetCurrentTime()
get Current Time
return dateFormatting.format(calendar.getTime());
StringgetCurrentTime()
get Current Time
if (_currentDate != null) {
    _currentDate.setTime(System.currentTimeMillis());
} else {
    _currentDate = new Date();
if (_dateFormat == null) {
    _dateFormat = new SimpleDateFormat("MMM-dd-yyyy__hh-mm-ssa");
return _dateFormat.format(_currentDate);