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

StringgetTodayTime()
get Today Time
return getDate(new Date(), "yyyy.MM.dd HH:mm:ss");
StringgetTodayTimeForDB()
get Today Time For DB
return getDate(new Date(), "yyyy/MM/dd HH:mm:ss");
DategetTodayWithTime(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);
...
StringgetTodayYmd()
get Today Ymd
Calendar c = Calendar.getInstance();
return new SimpleDateFormat(YYYYMMDD_FORMAT).format(c.getTime());
StringgetTodayYMD()
get Today YMD
Date date = new Date();
SimpleDateFormat formatter;
String pattern = "yyyyMMdd";
formatter = new SimpleDateFormat(pattern, new Locale("ko", "KOREA"));
return formatter.format(date);
DategetTodayZero()
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();
DategetTodayZero()
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();
DategetTodayZeroHour()
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();
StringgetTommorrow(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);
...
StringgetYestoday()
get Yestoday
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -1);
return new SimpleDateFormat("yyyyMMdd").format(calendar.getTime());