Javatpoint Logo
Javatpoint Logo

Java SQL Date toInstant() Method

The toInstant() method of Java Date class always throws an UnsupportedOperationException. As SQL Date values don't have time component so this method should not be used. This method overrides toInstant in class Date.

Syntax

Parameters

NA

Returns

It returns an instant which represents the same point on the time-line as this date object.

Exception

UnsupportedOperationException is thrown if the method is invoked.

Example

Test it Now

Output:

Exception in thread "main" java.lang.UnsupportedOperationException
	at java.sql/java.sql.Date.toInstant(Unknown Source)
	at date.JavaDateExample1.main(JavaDateExample1.java:12)

Next Topic



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