Java Utililty Methods Time Now

List of utility methods to do Time Now

Description

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

Method

StringcurrentTimeStr()
current Time Str
return toDateString(new Date(), DEFAULT_FORMAT_TIME);
StringcurrentTimeString()
current Time String
return DATE_FORMAT_PART.format(Calendar.getInstance().getTime());
StringcurrentTimeString(String pattern)
Formats NOW into a specific pattern.
SimpleDateFormat df = new SimpleDateFormat(pattern);
return df.format(new Date());
StringcurrtimeToString8()
currtime To String
return dateToString(new Date(), "yyyyMMdd");
Stringget_cur_datetime()
gecudatetime
String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss";
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
return sdf.format(cal.getTime());
StringgetCurDateBefore(long time)
get Cur Date Before
SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
return sdf.format(new Date().getTime() - time);
StringgetCurDateTime()
get Cur Date Time
return getCurDateTime(DEFAULTFORMAT);
StringgetCurDateTIme()
get Cur Date T Ime
return new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
StringgetCurentTimeDirsPath()
Creating file structure for next format /yyyy/MM/dd/
return DATA_DIR_FORMAT.format(new Date());
DategetCurrDateTime()
get Curr Date Time
return stringToDate(getCurrTime());