"how to convert localdate to sql date java?" Code Answer


the answer is really simple;

import java.sql.date;
localdate locald = localdate.of(1967, 06, 22);
date date = date.valueof(locald); // magic happens here!

if you would want to convert it the other way around, you do it like this:

date date = r.getdate();
localdate locald = date.tolocaldate();

r is the record you're using in jooq and .getdate() is the method for getting the date out of your record; let's say you have a date column called date_of_birth, then your get method should be called getdateofbirth().

By clucas on July 5 2022

Answers related to “how to convert localdate to sql date java?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.