< prev index next >

src/java.sql/share/classes/java/sql/Timestamp.java

Print this page




  52  * {@code java.util.Date} component. The fractional seconds - the nanos - are
  53  * separate.  The {@code Timestamp.equals(Object)} method never returns
  54  * {@code true} when passed an object
  55  * that isn't an instance of {@code java.sql.Timestamp},
  56  * because the nanos component of a date is unknown.
  57  * As a result, the {@code Timestamp.equals(Object)}
  58  * method is not symmetric with respect to the
  59  * {@code java.util.Date.equals(Object)}
  60  * method.  Also, the {@code hashCode} method uses the underlying
  61  * {@code java.util.Date}
  62  * implementation and therefore does not include nanos in its computation.
  63  * <P>
  64  * Due to the differences between the {@code Timestamp} class
  65  * and the {@code java.util.Date}
  66  * class mentioned above, it is recommended that code not view
  67  * {@code Timestamp} values generically as an instance of
  68  * {@code java.util.Date}.  The
  69  * inheritance relationship between {@code Timestamp}
  70  * and {@code java.util.Date} really
  71  * denotes implementation inheritance, and not type inheritance.


  72  */
  73 public class Timestamp extends java.util.Date {
  74 
  75     private static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
  76 
  77     /**
  78      * Constructs a {@code Timestamp} object initialized
  79      * with the given values.
  80      *
  81      * @param year the year minus 1900
  82      * @param month 0 to 11
  83      * @param date 1 to 31
  84      * @param hour 0 to 23
  85      * @param minute 0 to 59
  86      * @param second 0 to 59
  87      * @param nano 0 to 999,999,999
  88      * @deprecated instead use the constructor {@code Timestamp(long millis)}
  89      * @exception IllegalArgumentException if the nano argument is out of bounds
  90      */
  91     @Deprecated(since="1.2")




  52  * {@code java.util.Date} component. The fractional seconds - the nanos - are
  53  * separate.  The {@code Timestamp.equals(Object)} method never returns
  54  * {@code true} when passed an object
  55  * that isn't an instance of {@code java.sql.Timestamp},
  56  * because the nanos component of a date is unknown.
  57  * As a result, the {@code Timestamp.equals(Object)}
  58  * method is not symmetric with respect to the
  59  * {@code java.util.Date.equals(Object)}
  60  * method.  Also, the {@code hashCode} method uses the underlying
  61  * {@code java.util.Date}
  62  * implementation and therefore does not include nanos in its computation.
  63  * <P>
  64  * Due to the differences between the {@code Timestamp} class
  65  * and the {@code java.util.Date}
  66  * class mentioned above, it is recommended that code not view
  67  * {@code Timestamp} values generically as an instance of
  68  * {@code java.util.Date}.  The
  69  * inheritance relationship between {@code Timestamp}
  70  * and {@code java.util.Date} really
  71  * denotes implementation inheritance, and not type inheritance.
  72  *
  73  * @since 1.1
  74  */
  75 public class Timestamp extends java.util.Date {
  76 
  77     private static final JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
  78 
  79     /**
  80      * Constructs a {@code Timestamp} object initialized
  81      * with the given values.
  82      *
  83      * @param year the year minus 1900
  84      * @param month 0 to 11
  85      * @param date 1 to 31
  86      * @param hour 0 to 23
  87      * @param minute 0 to 59
  88      * @param second 0 to 59
  89      * @param nano 0 to 999,999,999
  90      * @deprecated instead use the constructor {@code Timestamp(long millis)}
  91      * @exception IllegalArgumentException if the nano argument is out of bounds
  92      */
  93     @Deprecated(since="1.2")


< prev index next >