Java Convert String to Date and Compare

Java Convert String to Date and Compare
Here is a code to convert Java String to date and compare with date field in MySQL table.
This conversion is done to make comparison easier with the date field in MySQL table, so i have not used Simple Date Format function. Using Simple date format you can change the format of date.
This code is tested in Netbeans.

MySQL Table:

Note: Insert sample date using mysql query, I have inserted a date: “insert into datecheck values(‘2015-08-20’)

convert.java

 

Java String to Date conversion and compare with date in mysql, java string to date, string to date conversion

 

One thought on “Java Convert String to Date and Compare

Leave a Reply

Your email address will not be published. Required fields are marked *