List of utility methods to do Today
String | getTodayTime() get Today Time return getDate(new Date(), "yyyy.MM.dd HH:mm:ss"); |
String | getTodayTimeForDB() get Today Time For DB return getDate(new Date(), "yyyy/MM/dd HH:mm:ss"); |
Date | getTodayWithTime(final String iTime) get Today With Time final SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); Calendar calParsed = Calendar.getInstance(); calParsed.setTime(df.parse(iTime)); Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, calParsed.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, calParsed.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, calParsed.get(Calendar.SECOND)); cal.set(Calendar.MILLISECOND, 0); ... |
String | getTodayYmd() get Today Ymd Calendar c = Calendar.getInstance(); return new SimpleDateFormat(YYYYMMDD_FORMAT).format(c.getTime()); |
String | getTodayYMD() get Today YMD Date date = new Date(); SimpleDateFormat formatter; String pattern = "yyyyMMdd"; formatter = new SimpleDateFormat(pattern, new Locale("ko", "KOREA")); return formatter.format(date); |
Date | getTodayZero() get Today Zero Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); return c.getTime(); |
Date | getTodayZero() get Today Zero java.util.Calendar c = java.util.Calendar.getInstance(); c.setTime(new Date()); c.set(java.util.Calendar.HOUR_OF_DAY, 0); c.set(java.util.Calendar.MINUTE, 0); c.set(java.util.Calendar.SECOND, 0); return c.getTime(); |
Date | getTodayZeroHour() get Today Zero Hour Calendar cal = Calendar.getInstance();
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.HOUR, 0);
return cal.getTime();
|
String | getTommorrow(String today) get Tommorrow Calendar cal = Calendar.getInstance();
cal.set(Integer.parseInt(today.substring(0, 4)), Integer.parseInt(today.substring(4, 6)) - 1,
Integer.parseInt(today.substring(6, 8)));
cal.add(Calendar.DATE, 1);
String curMonth, curDay;
int tmpMonth, tmpDay;
tmpMonth = cal.get(Calendar.MONTH) + 1;
tmpDay = cal.get(Calendar.DATE);
...
|
String | getYestoday() get Yestoday Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DATE, -1); return new SimpleDateFormat("yyyyMMdd").format(calendar.getTime()); |