com.ibm.as400.access
Class AS400JDBCTimestamp
- java.lang.Object
-
- java.util.Date
-
- java.sql.Timestamp
-
- com.ibm.as400.access.AS400JDBCTimestamp
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.Date>
public class AS400JDBCTimestamp extends java.sql.Timestamp
A version of an java.sql.Timestamp that support picosecond precision.- See Also:
Timestamp
, Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AS400JDBCTimestamp(long time)
Create an AS400JDBC TimestampAS400JDBCTimestamp(long time, int length)
Create an AS400JDBC Timestamp
-
Method Summary
Methods Modifier and Type Method and Description boolean
after(java.sql.Timestamp ts)
Indicates whether this Timestamp object is later than the given Timestamp object.boolean
before(java.sql.Timestamp ts)
Indicates whether this Timestamp object is earlier than the given Timestamp object.int
compareTo(java.util.Date o)
Compares this Timestamp object to the given Date, which must be a Timestamp object.int
compareTo(java.sql.Timestamp ts)
Compares this Timestamp object to the given Timestamp object.boolean
equals(java.lang.Object obj)
Tests to see if this Timestamp object is equal to the given object.boolean
equals(java.sql.Timestamp ts)
Tests to see if this Timestamp object is equal to the given Timestamp object.int
getNanos()
Gets this Timestamp object's nanos value.long
getPicos()
Get this Timestamp objects' picos value.void
setNanos(int nanos)
Sets the nanos values for this Timestamp object.void
setPicos(long picos)
Sets the picos value for this Timestamp object.void
setTime(long millis)
Sets this Timestamp object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.java.lang.String
toString()
static java.sql.Timestamp
valueOf(java.lang.String inString)
-
-
-
Constructor Detail
-
AS400JDBCTimestamp
public AS400JDBCTimestamp(long time, int length)
Create an AS400JDBC Timestamp- Parameters:
time
- milliseconds since January 1, 1970, 00:00:00 GMT.length
- Length of the formatted timestamp. Valid values are 19,21-32
-
AS400JDBCTimestamp
public AS400JDBCTimestamp(long time)
Create an AS400JDBC Timestamp- Parameters:
time
- milliseconds since January 1, 1970, 00:00:00 GMT.
-
-
Method Detail
-
getPicos
public long getPicos()
Get this Timestamp objects' picos value.- Returns:
- the picos value for this timestamp object
-
setPicos
public void setPicos(long picos)
Sets the picos value for this Timestamp object.- Parameters:
picos
-
-
getNanos
public int getNanos()
Gets this Timestamp object's nanos value.- Overrides:
getNanos
in classjava.sql.Timestamp
- Returns:
- this Timestamp object's factional seconds component
-
setNanos
public void setNanos(int nanos)
Sets the nanos values for this Timestamp object.- Overrides:
setNanos
in classjava.sql.Timestamp
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.sql.Timestamp
-
setTime
public void setTime(long millis)
Sets this Timestamp object to represent a point in time that is time milliseconds after January 1, 1970 00:00:00 GMT.- Overrides:
setTime
in classjava.sql.Timestamp
- Parameters:
millis
- -- the number of milliseconds- See Also:
Timestamp.setTime(long)
-
equals
public boolean equals(java.sql.Timestamp ts)
Tests to see if this Timestamp object is equal to the given Timestamp object. Two timestamps are equal if both their millisecond time and picosecond time are equal.- Overrides:
equals
in classjava.sql.Timestamp
- Parameters:
ts
- the Timestamp value to compare with- Returns:
- true if the given Timestamp object is equal to this Timestamp object; false otherwise
- See Also:
Timestamp.equals(java.sql.Timestamp)
-
equals
public boolean equals(java.lang.Object obj)
Tests to see if this Timestamp object is equal to the given object. If the given object is not a timestamp object, then the two objects are not equal.- Overrides:
equals
in classjava.sql.Timestamp
-
before
public boolean before(java.sql.Timestamp ts)
Indicates whether this Timestamp object is earlier than the given Timestamp object.- Overrides:
before
in classjava.sql.Timestamp
- Parameters:
ts
- - the Timestamp value to compare with- Returns:
- true if this Timestamp object is earlier; false otherwise
- See Also:
Timestamp.before(java.sql.Timestamp)
-
after
public boolean after(java.sql.Timestamp ts)
Indicates whether this Timestamp object is later than the given Timestamp object.- Overrides:
after
in classjava.sql.Timestamp
- Parameters:
ts
- - the Timestamp value to compare with- Returns:
- true if this Timestamp object is later; false otherwise
- See Also:
Timestamp.after(java.sql.Timestamp)
-
compareTo
public int compareTo(java.sql.Timestamp ts)
Compares this Timestamp object to the given Timestamp object.- Overrides:
compareTo
in classjava.sql.Timestamp
- Parameters:
ts
- - the Timestamp object to be compared to this Timestamp object- Returns:
- the value 0 if the two Timestamp objects are equal; a value less than 0 if this Timestamp object is before the given argument; and a value greater than 0 if this Timestamp object is after the given argument.
- Since:
- 1.2
- See Also:
Timestamp.compareTo(java.sql.Timestamp)
-
compareTo
public int compareTo(java.util.Date o)
Compares this Timestamp object to the given Date, which must be a Timestamp object. If the argument is not a Timestamp object, this method throws a ClassCastException object. (Timestamp objects are comparable only to other Timestamp objects.)- Specified by:
compareTo
in interfacejava.lang.Comparable<java.util.Date>
- Overrides:
compareTo
in classjava.sql.Timestamp
- Parameters:
o
- - the Date to be compared, which must be a Timestamp object- Returns:
- the value 0 if this Timestamp object and the given object are equal; a value less than 0 if this Timestamp object is before the given argument; and a value greater than 0 if this Timestamp object is after the given argument.
- Throws:
java.lang.ClassCastException
- - if the argument is not a Timestamp object- See Also:
Date.compareTo(java.util.Date)
-
valueOf
public static java.sql.Timestamp valueOf(java.lang.String inString)
-
-