Java Utililty Methods LocalDate Create

List of utility methods to do LocalDate Create

Description

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

Method

LocalDategetCurrentLocalDate()
get Current Local Date
return LocalDate.now(ZoneId.systemDefault());
LocalDategetCurrentLocalDate()
Returns the current London local date.
return Calendar.getInstance().getTime().toInstant().atZone(TimeZone.getTimeZone("Europe/London").toZoneId())
        .toLocalDate();
LocalDategetCurrentLocalDate()
get the current date and time in LocalDate format
Calendar currentDateTime = Calendar.getInstance();
LocalDate currentDate = LocalDate.parse(dateFormat.format(currentDateTime.getTime()).toString(),
        germanFormatter);
return currentDate;
voidgetLocalDate(int year, int atDay)
get Local Date
LocalDate date = Year.of(year).atDay(atDay);
LocalDategetLocalDate(java.util.Date date)
Convert a Date to a LocalDate at the system's default time zone.
if (date == null)
    return null;
return getLocalDateTime(date).toLocalDate();
LocalDategetLocalDate(long timeInMillis)
Get LocalDate for time in milli seconds.
return getLocalDateTime(timeInMillis).toLocalDate();
LocalDatetoLocalDate(Calendar calendar)
Convert a Calendar value into a LocalDate .
if (calendar != null) {
    return LocalDate.of(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1,
            calendar.get(Calendar.DAY_OF_MONTH));
return null;
LocalDatetoLocalDate(final Date date)
to Local Date
if (date == null) {
    return null;
} else {
    String str = new SimpleDateFormat("yyyy-MM-dd").format(date);
    return LocalDate.parse(str);