Java Timestamp toInstant() MethodThe toInstant() method of Timestamp class coverts the Timespan object to an Instant which represents the same point on the time-line as this Timestamp. SyntaxParametersNA ReturnsThe toInstant () method of Timestamp class returns an Instant which represents the same point on the time-line as this Timestamp. OverridesThe toInstant () method of Timestamp class overrides: toInstant () method in class Date Example 1Test it NowOutput: Timestamp : 2018-09-01 09:01:15.0 Instant Timespan : 2018-09-01T03:31:15Z Example 2Test it NowOutput: Timestamp : 2018-09-06 11:59:02.683 Current instant Timespan : 2018-09-06T06:29:02.683Z
Next TopicJava Timestamp
|