List of utility methods to do Today
long | getTodayNight() get Today Night Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, MY_HOUR_OF_DAY);
cal.set(Calendar.SECOND, MY_SECOND);
cal.set(Calendar.MINUTE, MY_MINUTE);
cal.set(Calendar.MILLISECOND, MY_MILLISECOND);
return cal.getTimeInMillis();
|
String | getTodaysDate() get Todays Date Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("YYYYMMdd-HHmmss"); return sdf.format(date); |
String | getTodaysDate(String dateFormat) Get today's date and return it in the right format SimpleDateFormat timeFormat = new SimpleDateFormat(dateFormat); timeFormat.setTimeZone(TimeZone.getDefault()); return timeFormat.format(new Date()); |
long | getTodayStart() get Today Start Calendar c = new GregorianCalendar(); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); return c.getTime().getTime(); |
String | getTodayStr() get Today Str DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); String todayAsString = df.format(new Date()); return todayAsString; |
String | getTodayStr() getToday get todat string with format YYYY-MM-DD from a Date object Calendar calendar = Calendar.getInstance();
return getDateStr(calendar.getTime());
|
String | getTodayString() yyyyMMdd DateFormat dateFormat = createNewDateFormat(shortFormat); return formatDateString(new Date(), dateFormat); |
String | getTodayString() get Today String return format(new Date()); |
String | getTodayString() return a string of todays date suitable for use in a file name SimpleDateFormat sdf = new SimpleDateFormat("dd_MMM_yyyy"); final String dateText = sdf.format(new Date()); return dateText; |
String | getTodayString() returns Today in String (YYYYMMDD format) return getTodayInFormat("yyyyMMdd"); |