Java LocalDate to Date date(LocalDate date)

Here you can find the source of date(LocalDate date)

Description

date

License

Open Source License

Declaration

public static String date(LocalDate date) 

Method Source Code


//package com.java2s;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class Main {
    private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
    private static final DateTimeFormatter timestampFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
    private static final DateTimeFormatter zonelessTimestampFormatter = DateTimeFormatter
            .ofPattern("yyyy-MM-dd HH:mm:ss");

    public static String date(LocalDate date) {
        return dateFormatter.format(date);
    }//from   www.j  a  v  a2  s .c o  m

    public static String date(ZonedDateTime date) {
        return timestampFormatter.format(date);
    }

    public static String date(LocalDateTime date) {
        return zonelessTimestampFormatter.format(date);
    }
}

Related

  1. convertToDate(LocalDate localDate)
  2. date(LocalDate d, ZoneId zone)
  3. date(LocalDate date)
  4. date(LocalDate date)
  5. localDateToDate(LocalDate date)
  6. localDateToDate(LocalDate ld)
  7. toDate(final LocalDate localDate)