Javatpoint Logo
Javatpoint Logo

Java Timestamp toInstant() Method

The toInstant() method of Timestamp class coverts the Timespan object to an Instant which represents the same point on the time-line as this Timestamp.

Syntax

Parameters

NA

Returns

The toInstant () method of Timestamp class returns an Instant which represents the same point on the time-line as this Timestamp.

Overrides

The toInstant () method of Timestamp class overrides:

toInstant () method in class Date

Example 1

Test it Now

Output:

Timestamp : 2018-09-01 09:01:15.0
Instant Timespan : 2018-09-01T03:31:15Z

Example 2

Test it Now

Output:

Timestamp : 2018-09-06 11:59:02.683
Current instant Timespan : 2018-09-06T06:29:02.683Z
Next TopicJava Timestamp





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA