Java API Tutorial - Java Timestamp.equals(Object ts)








Syntax

Timestamp.equals(Object ts) has the following syntax.

public boolean equals(Object ts)

Example

In the following code shows how to use Timestamp.equals(Object ts) method.

/* ww  w  .  j  av a2s . com*/
public class Main {
  public static void main(String[] args) {
    java.sql.Timestamp ts1 = java.sql.Timestamp.valueOf("2012-04-06 09:01:10");
    java.sql.Timestamp ts2 = java.sql.Timestamp.valueOf("2013-04-06 09:01:10");
    
    System.out.println(ts1.equals(ts2));

  }
}

The code above generates the following result.