List of utility methods to do Date Create
int | date(Date d) date Calendar cal = Calendar.getInstance();
cal.setTime(d);
return cal.get(Calendar.DATE);
|
Date | date(final int year, final int month, final int dayOfMonth) An easy and non-deprecated non-lenient way of creating Date objects. final Calendar cal = Calendar.getInstance(); cal.setLenient(false); cal.set(year, month - 1, dayOfMonth, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); |
Calendar | date(int day, int month, int year) date return new GregorianCalendar(year, month - 1, day); |
Date | date(int y, int m, int d) date Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, y + 1900);
c.set(Calendar.MONTH, m);
c.set(Calendar.DAY_OF_MONTH, d);
return c.getTime();
|
Date | date(int year, int month, int date) date Calendar working = GregorianCalendar.getInstance();
working.set(year, month, date, 0, 0, 1);
return working.getTime();
|
Date | date(int year, int month, int day) date Calendar cal = Calendar.getInstance(); cal.setTimeZone(TimeZone.getTimeZone("GMT")); cal.set(year - 1900, month - 1, day); return cal.getTime(); |
Date | date(int year, int month, int day) date Calendar calendar = Calendar.getInstance();
calendar.set(year, month - 1, day, 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
|
Date | date(int year, int month, int day) Convenience method to create a new date return date(year, month, day, 0, 0, 0);
|
Calendar | date(int year, int month, int day) date Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); ... |
Date | date(int year, int month, int day, int hour, int minute) date Calendar c = Calendar.getInstance();
c.set(year, month - 1, day, hour, minute, 0);
c.set(Calendar.MILLISECOND, 0);
return c.getTime();
|