I have a pojo which has a filed type as Instant. I want to set the Instant getting it from TimsStamp. Would it be possible?
For example: I have a java.sql.Timestamp
which I want to convert to java.time.Instant.
Would it be possible?
we have ready have existing methods which covert Timestamp to Instant and vice versa.
Instant instant = Instant.now(); // get The current time in instant object
Timestamp t=java.sql.Timestamp.from(instant); // Convert instant to Timestamp
Instant anotherInstant=t.toInstant(); // Convert Timestamp to Instant