List of utility methods to do Date Create
Calendar | createDate(final Date date) create Date final Calendar cal = Calendar.getInstance(Locale.getDefault()); cal.setTime(date); return cal; |
Date | createDate(final Date date) create Date final Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return clearDate(calendar.getTime()); |
Date | createDate(final int aYear, final int aMonth, final int aDate, final int aHour, final int aMinute, final int aSecond) create Date Calendar c = Calendar.getInstance();
c.set(aYear, aMonth, aDate, aHour, aMinute, aSecond);
return c.getTime();
|
Date | createDate(final int day, final int month, final int year) Creates a date from the given components. Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.YEAR, year);
return cal.getTime();
|
Date | createDate(final int month, final int day, final int year) Create a Date object with the specified date. final Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DAY_OF_MONTH, day);
cal.set(Calendar.YEAR, year);
cal.set(Calendar.HOUR, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
...
|
Date | createDate(final int year, final int month, final int day, final int hour, final int minute, final int second, final int millisecond) create Date CALENDAR.clear();
CALENDAR.set(year, month - 1, day, hour, minute, second);
CALENDAR.set(Calendar.MILLISECOND, millisecond);
return CALENDAR.getTime();
|
Date | createDate(final int yyyy, final int month, final int day) Creates a date. CALENDAR.clear();
CALENDAR.set(yyyy, month - 1, day);
return CALENDAR.getTime();
|
Date | createDate(int month, int day) create Date Calendar c = Calendar.getInstance();
c.set(c.get(Calendar.YEAR), month - 1, day, 0, 0, 0);
c.set(Calendar.MILLISECOND, 0);
return c.getTime();
|
Date | createDate(int year, int month, int date) create Date return createCalendar(year, month, date).getTime();
|
Date | createDate(int year, int month, int date) create Date GregorianCalendar calendar = new GregorianCalendar(); calendar.clear(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, date); return calendar.getTime(); |