add to java.sql.Date via LocalDate - Java java.sql

Java examples for java.sql:Date

Description

add to java.sql.Date via LocalDate

Demo Code


//package com.java2s;

import java.sql.Date;

import java.time.LocalDate;

public class Main {
    public static Date add(Date awal, int i) {
        LocalDate localDate = awal.toLocalDate();

        LocalDate newDate = localDate.plusDays(i);

        return toDate(newDate);
    }/*  ww  w .ja  v a  2 s.com*/

    public static Date toDate(LocalDate localDate) {
        return Date.valueOf(localDate);
    }
}

Related Tutorials