List of utility methods to do SQL LocalDate
Date | add(Date awal, int i) add LocalDate localDate = awal.toLocalDate();
LocalDate newDate = localDate.plusDays(i);
return toDate(newDate);
|
Date | addDays(final Date date, final int daysToAdd) add Days return new Date(Date.valueOf(date.toLocalDate().plusDays(daysToAdd)).getTime()); |
LocalDate | asLocalDate(Date date) as Local Date if (date == null) { return null; if (date instanceof java.sql.Date) { return ((java.sql.Date) date).toLocalDate(); } else { return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate(); |
LocalDate | asLocalDate(Date date) Obtains an instance of LocalDate from a date object. return asLocalDate(date, getDefaultTimeZone());
|
LocalDate | asLocalDate(java.util.Date date, ZoneId zone) as Local Date if (date == null) return null; if (date instanceof java.sql.Date) return ((java.sql.Date) date).toLocalDate(); else return Instant.ofEpochMilli(date.getTime()).atZone(zone).toLocalDate(); |
Date | asUtilDate(Object date) Calls #asUtilDate(Object,ZoneId) with the system default time zone. return asUtilDate(date, ZoneId.systemDefault());
|
java.util.Date | asUtilDate(Object date, ZoneId zone) Creates a java.util.Date from various date objects. if (date == null) { return null; if (date instanceof java.sql.Date || date instanceof java.sql.Timestamp) { return new java.util.Date(((java.util.Date) date).getTime()); if (date instanceof java.util.Date) { return (java.util.Date) date; ... |
Date | convertLocalDateToDatabaseDate(LocalDate localDate) convert Local Date To Database Date return Date.valueOf(localDate);
|
int | getDay(Date date) get Day LocalDate localDate = date.toLocalDate();
return localDate.getDayOfMonth();
|
Date | getLastDate() get Last Date LocalDate localDate = LocalDate.now(); Date date = Date.valueOf(localDate); int year = getYear(date); Month month = getMonth(date); return getLastDate(month, year); |