Package xal.ca
Class Timestamp
java.lang.Object
xal.ca.Timestamp
- All Implemented Interfaces:
Comparable<Timestamp>
Timestamp
- Author:
- tap
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTimestamp(BigDecimal timestamp) Primary constructor from the full precision seconds since the Java epoch.Construct a Timestamp from a java.sql.Timestamp -
Method Summary
Modifier and TypeMethodDescriptionintCompare this timestamp with another timestamp.booleanDetermine if the specified timestamp equals this one.getDate()Get the times tamp as a Java Date.Get the time in seconds with full precision since the Java epoch.doubleGet the time in seconds since the Java epoch.Get the SQL Timestamp equivalent of this instance.longgetTime()Get the timestamp in milliseconds relative to the Java epoch.inthashCode()Override the hashcode as required when overriding equals.toString()Get a string representation of the Timestamp.toString(DateFormat timeFormat) Generate a string representation of this timestamp using the specified time format for the time format up to seconds.
-
Field Details
-
timestampBD
the timestamp information
-
-
Constructor Details
-
Timestamp
Primary constructor from the full precision seconds since the Java epoch.- Parameters:
timestamp- the number of seconds since the Java epoch
-
Timestamp
Construct a Timestamp from a java.sql.Timestamp- Parameters:
timestamp- an SQL timestamp
-
-
Method Details
-
getDate
Get the times tamp as a Java Date. Some precision is lost since the Date class only supports millisecond resolution.- Returns:
- The time stamp as a Date.
-
getTime
public long getTime()Get the timestamp in milliseconds relative to the Java epoch.- Returns:
- The time in milliseconds since the Java epoch.
-
getSeconds
public double getSeconds()Get the time in seconds since the Java epoch.- Returns:
- the time in seconds since the Java epoch.
-
getFullSeconds
Get the time in seconds with full precision since the Java epoch.- Returns:
- the time in seconds since the Java epoch.
-
getSQLTimestamp
Get the SQL Timestamp equivalent of this instance.- Returns:
- the SQL Timestamp equivalent of this instance.
-
toString
Generate a string representation of this timestamp using the specified time format for the time format up to seconds. Subsecond time is appended using a decimal point.- Parameters:
timeFormat- format for which to generate the string- Returns:
- formatted string representation
-
toString
Get a string representation of the Timestamp. -
equals
Determine if the specified timestamp equals this one. -
hashCode
public int hashCode()Override the hashcode as required when overriding equals. Equality implies equality of the underlying timestamp instance variables. -
compareTo
Compare this timestamp with another timestamp.- Specified by:
compareToin interfaceComparable<Timestamp>- Parameters:
otherTimestamp- The timestamp with which to compare this one- Returns:
- 0 if the timestamps are the same, negative if this is earlier than the supplied one and positive otherwise
-