Java Utililty Methods Today

List of utility methods to do Today

Description

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

Method

DategetTodayHHmmss(String HHmmss)
get Today H Hmmss
String[] array = HHmmss.split(":");
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(array[0]));
calendar.set(Calendar.MINUTE, Integer.valueOf(array[1]));
calendar.set(Calendar.SECOND, Integer.valueOf(array[2]));
return calendar.getTime();
StringgetTodayInFormat(String format)
getTodayInFormat
Date td = new Date();
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(format);
String datenewformat = formatter.format(td);
return datenewformat;
longgetTodayIntevalDays(String date)
get Today Inteval Days
try {
    Date currentDate = new Date();
    SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
    java.util.Date theDate = myFormatter.parse(date);
    long days = (currentDate.getTime() - theDate.getTime()) / (24 * 60 * 60 * 1000);
    return days;
} catch (Exception ee) {
    return 0l;
...
DategetTodayLast()
get Today Last
Calendar cal = Calendar.getInstance();
cal.setTime(getTodayZero());
cal.add(Calendar.DAY_OF_MONTH, 1);
cal.add(Calendar.MILLISECOND, -1);
return cal.getTime();
DategetTodayLastSecond()
get Today Last Second
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
calendar.set(year, month, day, 23, 59, 59);
return calendar.getTime();
DategetTodayLastSecond()
get Today Last Second
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
calendar.set(year, month, day, 23, 59, 59);
return calendar.getTime();
DateFormatgetTodayLastUpdateTimeFormat()
Returns time format used in status bar.
return todayLastUpdateTimeFormat.get();
DategetTodayLimit()
get Today Limit
return getDateEndTime(new Date());
DategetTodayMidnight()
Get the date of today's mid night.
return getCalender().getTime();
DategetTodayMin()
get Today Min
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();