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

StringgetCurrentDateFormated()
Formats only current time into String.
return new SimpleDateFormat("HH:mm:ss EEE, dd MMM yyyy").format(new Date());
longgetCurrentDateInMillis()
get Current Date In Millis
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
...
StringgetCurrentDateInSqlFormat()
get Current Date In Sql Format
Date currentDate = new Date();
return dateToSqlFormat(currentDate);
StringgetCurrentDateINYYYY_MM_DD()
get Current Date INYYYMDD
return convertTimeInMillisecondsToDateInYYY_MM_DD(System.currentTimeMillis());
StringgetCurrentDateInyyyyMMddFormat()
get Current Date Inyyyy M Mdd Format
Date date = new Date();
return convertDateToString(date, DATE_PATTERN_YYYYMMDD);
StringgetCurrentDateINYYYYMMDDHHMMSSwithColons()
get Current Date INYYYYMMDDHHMMS Swith Colons
DateFormat dateFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");
Date date = new Date(System.currentTimeMillis());
return dateFormat.format(date);
StringgetCurrentDateMMDDYYYY()
Gets current date.
Date date = new Date();
SimpleDateFormat MM_DD_YYYY_FORMAT = new SimpleDateFormat("MM/dd/yyyy");
String currentDate = MM_DD_YYYY_FORMAT.format(date);
return currentDate;
StringgetCurrentDateSlashStr()
Gets the current date slash str.
return formatSlashDate(new Date());
StringgetCurrentDateStr()
get Current Date Str
return dateToString(getCurrentDate());
StringgetCurrentDateStr()
get Current Date Str
Date date = new Date();
DateFormat dtf = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
String str = dtf.format(date);
return str;