Javatpoint Logo
Javatpoint Logo

Java Timestamp equals() Method

The equals () method of Timestamp class returns a Boolean value true if this Timestamp object is equal to the given object or to the given Timestamp object .

Syntax

Parameters

The parameter 'ts' represents the Timestamp value or the object value to compare with.

Returns

The equals() method of Timestamp class returns :

  • Boolean value true if this Timestamp object is equal to the given object or to the given Timestamp object. A value less than 0 if this Timespan object is before the given argument.
  • Else, it returns false.

Example 1

Test it Now

Output:

Both values are unequal.

Example 2

Test it Now

Output:

Expire Timespan : 2018-09-03 09:01:15.0
Today date : Sun Sep 02 20:48:37 IST 2018
oops!Your plan is about to expire or has expired
Recharge fast.
Next TopicJava Timestamp




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials