Java SQL LocalDate toDate(LocalDate localDate)

Here you can find the source of toDate(LocalDate localDate)

Description

Convert a LocalDate to a Date.

License

BSD License

Declaration

public static java.sql.Date toDate(LocalDate localDate) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

import java.sql.Timestamp;
import java.time.*;

public class Main {
    /**/*from www  .j  a v a  2  s  . c  o  m*/
     * Convert a LocalDate to a Date. Returns null on null input.
     */
    public static java.sql.Date toDate(LocalDate localDate) {
        if (localDate == null)
            return null;
        return java.sql.Date.valueOf(localDate);
    }

    /**
     * Convert a LocalDateTime to a Date. Returns null on null input.
     */
    public static Timestamp toDate(LocalDateTime localDateTime) {
        if (localDateTime == null)
            return null;
        return Timestamp.valueOf(localDateTime);
    }
}

Related

  1. getLocalDateFromUtilDate(Date input)
  2. getSqlDate(java.util.Date paramDate)
  3. setDate(PreparedStatement s, int col, LocalDate ld)
  4. toDate(LocalDate localDate)
  5. toDate(LocalDate localDate)
  6. toInstant(Date date)
  7. toJavaDate(DateMidnight dm)
  8. toJDBC(LocalDate fecha)
  9. toLocalDate(Date date)