I have a Date format in java that I need to save as a Time format in MySQL. Is there a way to just get the time part from the date? I know Dat.gettime() that returns a long but I just need the Time in MySql
Any suggestions...
Thx all ..
Using a PreparedStatement together with a java.sql.Time object created from your java.util.Date should work:
java.util.Date myDate = ....
java.sql.Time theTime = new java.sql.Time(myDate.getTime());
PreparedStatement pstmt = ...
pstmt.setTime(1, theTime);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With