Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.sql.Timestamp to Joda Instant and vice versa

Is this possible? I found a few solution for converting to and from localDateTime like can be seen here

But I can't find a solution for Joda Instant...

like image 632
JTK Avatar asked Oct 30 '25 00:10

JTK


1 Answers

You can use the epoch millis to convert:

Timestamp ts = ....;
Instant i = new Instant(ts.getTime());
Timestamp ts2 = new Timestamp(i.getMillis());
like image 109
assylias Avatar answered Oct 31 '25 13:10

assylias



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!