List of utility methods to do Today
Date | getTodayHHmmss(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(); |
String | getTodayInFormat(String format) getTodayInFormat Date td = new Date(); java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(format); String datenewformat = formatter.format(td); return datenewformat; |
long | getTodayIntevalDays(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; ... |
Date | getTodayLast() 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();
|
Date | getTodayLastSecond() 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(); |
Date | getTodayLastSecond() 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(); |
DateFormat | getTodayLastUpdateTimeFormat() Returns time format used in status bar. return todayLastUpdateTimeFormat.get();
|
Date | getTodayLimit() get Today Limit return getDateEndTime(new Date()); |
Date | getTodayMidnight() Get the date of today's mid night. return getCalender().getTime();
|
Date | getTodayMin() 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();
|