A java.util.Date is not a java.sql.Date. It's the other way around. A java.sql.Date is a java.util.Date.

You'll need to convert it to a java.sql.Date by using the constructor that takes a long that a java.util.Date can supply.

java.sql.Date sqlDate = new java.sql.Date(utilDate.getTime());
Answer from rgettman on Stack Overflow
🌐
Dariawan
dariawan.com › tutorials › java › java-sql-date-examples
java.sql.Date Examples | Dariawan
July 24, 2019 - We can instantiate a java.sql.Date object using following constructor: Date(long date): Constructs a Date object using the given milliseconds time value. Here the example: SqlDateInitExample.java ·
🌐
Oracle
docs.oracle.com › javase › 8 › docs › api › java › sql › Date.html
Date (Java Platform SE 8 )
October 20, 2025 - Java™ Platform Standard Ed. 8 ... A thin wrapper around a millisecond value that allows JDBC to identify this as an SQL DATE value.
🌐
TutorialsPoint
tutorialspoint.com › how-do-i-create-a-java-sql-date-object-in-java
How do I create a java.sql.Date object in Java?
February 5, 2021 - import java.sql.Date; public class Demo { public static void main(String args[]) { String str = "2017-12-03"; Date date = Date.valueOf(str); System.out.println("Date Value: "+date); } }
🌐
Baeldung
baeldung.com › home › java › java dates › convert java.util.date to java.sql.date
Convert java.util.Date to java.sql.Date | Baeldung
January 13, 2024 - SimpleDateFormat isoFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); isoFormat.setTimeZone(TimeZone.getTimeZone("America/Los_Angeles")); java.util.Date date = isoFormat.parse("2010-05-23T22:01:02"); TimeZone.setDefault(TimeZone.getTi...
🌐
W3Schools
w3schools.com › java › java_date.asp
Java Date and Time
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP, Bootstrap, Java, XML and more.
🌐
Jenkov
jenkov.com › tutorials › java-date-time › java-sql-date.html
Java's java.sql.Date
June 23, 2014 - ... The biggest difference between java.sql.Date and java.util.Date is that the java.sql.Date only keeps the date, not the time, of the date it represents. So, for instance, if you create a java.sql.Date using the date and time 2009-12-24 23:20, ...
🌐
Oracle
docs.oracle.com › en › java › javase › 22 › docs › api › java.sql › java › sql › Date.html
Date (Java SE 22 & JDK 22)
July 16, 2024 - Creates a LocalDate instance using the year, month and day from this Date object. ... This method always throws an UnsupportedOperationException and should not be used because SQL Date values do not have a time component.
Find elsewhere
🌐
Baeldung
baeldung.com › home › java › java dates › java.util.date vs java.sql.date
java.util.Date vs java.sql.Date | Baeldung
January 8, 2024 - It also doesn’t handle all dates very well. Technically, it should reflect coordinated universal time (UTC). However, that depends on an operating system of the host environment. Most modern operating systems use 1 day = 24h x 60m x 60s = 86400 seconds, which as we can see, doesn’t take the “leap second” into account. With the introduction of Java 8, java.time package should be used. Prior to Java 8, an alternative solution was available – Joda Time. The java.sql.Date extends java.util.Date class.
🌐
Oracle
docs.oracle.com › javase › 7 › docs › api › java › sql › Date.html
Date (Java Platform SE 7 )
Constructs a Date object using the given milliseconds time value. If the given milliseconds value contains time information, the driver will set the time components to the time in the default time zone (the time zone of the Java virtual machine running the application) that corresponds to zero GMT.
🌐
GeeksforGeeks
geeksforgeeks.org › java › how-to-convert-java-util-date-to-java-sql-date-in-java
How to Convert java.util.Date to java.sql.Date in Java? - GeeksforGeeks
July 23, 2025 - Date class of java.util package is required when data is required in a java application to do any computation or for other various things, while Date class of java.sql package is used whenever we need to store or read the data of DATE type in SQL, also Date class of java.sql package stores ...
🌐
InfluxData
influxdata.com › home › java date format: a detailed guide
Java Date Format: A Detailed Guide | InfluxData
July 12, 2024 - The code below creates a Timestamp ... a Timestamp object representing the current time Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis()); // Print the current timestamp System.out.println("Current Timestamp: ...
🌐
Dariawan
dariawan.com › tutorials › java › java-sql-date-java-sql-time-and-java-sql-timestamp
java.sql.Date, java.sql.Time, and java.sql.Timestamp | Dariawan
August 15, 2019 - As in above example, with setObject(int parameterIndex , x Object); we can just give a util.Date to the last three parameters which accept it without problem (this is also happen in another JDBC driver, not only MySQL). But to just use setObject(...) lazily can cause some problem, including data (or part of data) loss. Note: The URL suffix ?serverTimezone=Asia/Singapore is to suppress: Exception in thread "main" java.sql.SQLException: The server time zone value 'Malay Peninsula Standard Time' is unrecognized or represents more than one time zone.
🌐
Coderanch
coderanch.com › t › 775227 › java › Datetime-format-sql-server
Datetime format for sql server (Beginning Java forum at Coderanch)
July 7, 2023 - Is there a already existing class ...686436900) to look like the DATETIME format (DATETIME - format: YYYY-MM-DD HH:MI:SS) ? Basically something like : 2005-07-30 23:59:59.000 ... There must be; you can doubtless change the java.sql.Date object to a LocalDate....
🌐
Microsoft Learn
learn.microsoft.com › en-us › dotnet › api › java.sql.date
Date Class (Java.Sql) | Microsoft Learn
A thin wrapper around a millisecond value that allows JDBC to identify this as an SQL DATE value. [Android.Runtime.Register("java/sql/Date", DoNotGenerateAcw=true)] public class Date : Java.Util.Date
🌐
Medium
devdeejay.medium.com › working-with-sql-dates-in-java-mini-tutorial-for-beginners-4ce17af38b17
Working With SQL Dates in Java : Mini Tutorial For Beginners | by Dhananjay Trivedi | Medium
September 5, 2018 - Although, many of the methods of java.util.Date has been deprecated so don’t be too dependent on it while working with Dates. LocalDate class in Java 8 is a much more Thread safe, dependable option. I will be adding codes working with LocalDate very soon. ... Default Format Of Our SQL date is : 2018-09-04 Util Date : 2018-09-04 New Format : 04-09-2018 SQL Date As String : 2018-09-04 New Formatted Util Date : Tue Sep 04 00:00:00 IST 2018
🌐
Quora
quora.com › What-are-the-differences-between-java-sql-Date-vs-java-util-Date-vs-TimeStamp-vs-Calendar
What are the differences between java.sql.Date vs java.util. ...
Answer (1 of 2): All the classes ... the years. * java.util.Date is a very simple model of time, which just models "milliseconds since 1/1/1970" without any proper concept of timezone Th......
🌐
Coderanch
coderanch.com › t › 300652 › databases › java-sql-Date-Oracle-DateFormating
java.sql.Date, Oracle - DateFormating? (JDBC and Relational Databases forum at Coderanch)
If you are trying to get that date and store it into the "userdate" column, then you should not have to worry about the format if you are using a PreparedStatement. For example, you should be able to do something like this: Now, if you are trying to build an sql string and use a generic Statement to execute it, then you do have to format the date into a String first.
🌐
Codedamn
codedamn.com › news › java
How do you convert java.util.Date to java.sql.Date in Java?
December 27, 2022 - ... import java.sql.*; import java.util.*; public class UseJavaSqlTimeStamp { public static void main(String[] args) { java.util.Date newdate = new java.util.Date(); java.sql.Timestamp byusingtimestamp = new java.sql.Timestamp(newdate.getTime()); ...