Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to store java date type to mysql date type?

Tags:

java

mysql

how to store java date type to mysql date type?

like image 997
user354299 Avatar asked Feb 16 '26 07:02

user354299


1 Answers

See that your Date is a java.sql.Timestamp (especially if you want hours,mins,sec.. to be persisted)
You could convert a java.util.Date to a Timestamp like so: new Timestamp(date.getTime())

like image 130
Ryan Fernandes Avatar answered Feb 17 '26 21:02

Ryan Fernandes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!