List of utility methods to do LocalDate to
Date | from(LocalDate localDate, LocalTime localTime) from return from(localDate, localTime, ZoneOffset.UTC);
|
Date | from(LocalDate localDate, LocalTime localTime, ZoneOffset zoneOffset) from LocalDateTime localDateTime = localDate.atTime(localTime);
return from(localDateTime, zoneOffset);
|
Date | fromLocalDate(LocalDate date) Convert LocalDate to jud return date == null ? null : Date.from(date.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant());
|
Date | fromLocalDate(LocalDate date, TimeZone timeZone) Convert a LocalDate value into a Date , using default calendar. if (date != null) { final Calendar c = Calendar.getInstance(); if (timeZone != null) { c.setTimeZone(timeZone); c.set(Calendar.YEAR, date.getYear()); c.set(Calendar.MONTH, date.getMonthValue() - 1); c.set(Calendar.DAY_OF_MONTH, date.getDayOfMonth()); ... |
Date | toBadDate(LocalDate localDate, ZoneId timezone) Switches from a representation of date without time or a time zone to one that contains milliseconds from epoch as interpreted from some place with a time zone. return localDate == null ? null : Date.from(localDate.atStartOfDay(timezone).toInstant());
|
Calendar | toCalendar(LocalDate localDate) to Calendar if (localDate == null) { return null; Date date = toDate(localDate); Calendar cal = Calendar.getInstance(); cal.setTime(date); ; return cal; ... |
String | toDBString(LocalDate date) to DB String DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return format.format(date); |