Java Utililty Methods Date Create

List of utility methods to do Date Create

Description

The list of methods to do Date Create are organized into topic(s).

Method

CalendarcreateDate(final Date date)
create Date
final Calendar cal = Calendar.getInstance(Locale.getDefault());
cal.setTime(date);
return cal;
DatecreateDate(final Date date)
create Date
final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return clearDate(calendar.getTime());
DatecreateDate(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();
DatecreateDate(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();
DatecreateDate(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);
...
DatecreateDate(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();
DatecreateDate(final int yyyy, final int month, final int day)
Creates a date.
CALENDAR.clear();
CALENDAR.set(yyyy, month - 1, day);
return CALENDAR.getTime();
DatecreateDate(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();
DatecreateDate(int year, int month, int date)
create Date
return createCalendar(year, month, date).getTime();
DatecreateDate(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();