List of utility methods to do Date Today Get
Date | getDateToday() get Date Today Date curDate = new Date(); return curDate; |
long | getSystemDate() get System Date Date date = new Date(); return date.getTime(); |
String | getToday() get Today Date curDate = new Date(); SimpleDateFormat sdf; sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); today = sdf.format(curDate); return today; |
String | getTodayDateString() get Today Date String Calendar now = Calendar.getInstance(); int year = now.get(Calendar.YEAR); int month = now.get(Calendar.MONTH) + 1; int day = now.get(Calendar.DAY_OF_MONTH); String monthStr = String.valueOf(month); String dayStr = String.valueOf(day); if (month < 10) { monthStr = "0" + dayStr; ... |
long | getTodayEndTime() get Today End Time, "yyyy-MM-dd HH:mm" Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATE_YYYY_MM_DD); String strDate = sdf.format(date); Date date2 = null; try { date2 = sdf.parse(strDate); SimpleDateFormat sdf2 = new SimpleDateFormat( FORMAT_DATE_AND_TIME_YYYY_MM_DD_HH_MM); ... |
long | getTodayStartTime() get Today Start Time, "yyyy-MM-dd HH:mm" Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATE_YYYY_MM_DD); String strDate = sdf.format(date); Date date2 = null; try { date2 = sdf.parse(strDate); SimpleDateFormat sdf2 = new SimpleDateFormat( FORMAT_DATE_AND_TIME_YYYY_MM_DD_HH_MM); ... |
Date | today() today return resetTime(new Date()); |
Date | todayWithHour() today With Hour Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); int hour = cal.get(Calendar.HOUR_OF_DAY) + 1; cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); ... |
String | getDate() get Date SimpleDateFormat fromat = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); c.get(Calendar.YEAR); c.get(Calendar.MONTH + 1); c.get(Calendar.DAY_OF_MONTH); String time = fromat.format(c.getInstance().getTime()); return time; |
String | getCurrentDate() get Current Date Date date = new Date(System.currentTimeMillis()); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String text = sdf.format(date); return text; |