public class TimestampType extends java.lang.Object implements org.json_voltpatches.JSONString, java.lang.Comparable<TimestampType>
Constructor and Description |
---|
TimestampType()
Create a TimestampType instance for the current time.
|
TimestampType(java.util.Date date)
Create a TimestampType from a Java Date class.
|
TimestampType(long timestamp)
Create a TimestampType from microseconds from epoch.
|
TimestampType(java.lang.String param)
Construct from a timestamp string in a complete date or time format.
|
Modifier and Type | Method and Description |
---|---|
java.util.Date |
asApproximateJavaDate()
Retrieve a copy of the approximate Java date.
|
java.util.Date |
asExactJavaDate()
Retrieve a copy of the Java date for a TimeStamp with millisecond granularity.
|
java.sql.Date |
asExactJavaSqlDate()
Retrieve a properly typed copy of the Java date for a TimeStamp with millisecond granularity.
|
java.sql.Timestamp |
asJavaTimestamp()
Retrieve a properly typed copy of the Java Timestamp for the VoltDB TimeStamp.
|
int |
compareTo(TimestampType dateval)
CompareTo - to mimic Java Date
|
boolean |
equals(java.lang.Object o)
Equality.
|
long |
getTime()
Read the microsecond in time stored by this timestamp.
|
short |
getUSec()
Get the microsecond portion of this timestamp
|
int |
hashCode()
Hashcode with the same uniqueness as a Java Date.
|
static long |
millisFromJDBCformat(java.lang.String param)
Given a string parseable by the JDBC Timestamp parser, return the fractional component
in milliseconds.
|
java.lang.String |
toJSONString() |
java.lang.String |
toString()
An implementation of toString for debugging and printing VoltTables.
|
java.lang.String |
toString(java.util.TimeZone zone)
An implementation of toString for debugging and printing VoltTables
which allows the specification of a timezone.
|
public TimestampType(long timestamp)
timestamp
- microseconds since epoch.public TimestampType(java.util.Date date)
date
- Java Date instance.public TimestampType(java.lang.String param)
Timestamp
's string format.param
- A string in one of these formats:
"YYYY-MM-DD", "YYYY-MM-DD HH:MM:SS",
OR "YYYY-MM-DD HH:MM:SS.sss" with sss
allowed to be from 0 up to 6 significant digits.public TimestampType()
public static long millisFromJDBCformat(java.lang.String param)
param
- A timstamp in string format that is parseable by JDBC.java.lang.IllegalArgumentException
- if the timestamp uses higher than millisecond precision.public long getTime()
public short getUSec()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(java.util.TimeZone zone)
zone
- Desired timezone.public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(TimestampType dateval)
compareTo
in interface java.lang.Comparable<TimestampType>
public java.util.Date asApproximateJavaDate()
public java.util.Date asExactJavaDate()
public java.sql.Date asExactJavaSqlDate()
public java.sql.Timestamp asJavaTimestamp()
public java.lang.String toJSONString()
toJSONString
in interface org.json_voltpatches.JSONString