public class TIMESTAMP extends Datum implements java.io.Serializable, oracle.jdbc.internal.OracleTimestamp
The TIMESTAMP class provides conversions between the
Oracle Date (ldx_t) data type and Java classes java.sql.Date,
java.sql.Time, java.sql.Timestamp
The internal data for this object is stored as a eleven byte array in the super class' storage area. The bytes are arranged as follows:
Byte Represents
0 Century (119 for 1990)
1 Decade (190 for 1990)
2 Month
3 Day
4 Hour
5 Minute
6 Seconds
7 Nanoseconds
8 Nanoseconds
9 Nanoseconds
10 Nanoseconds
Static methods are used for conversions.
| Modifier and Type | Field and Description |
|---|---|
static int |
SIZE_DATE |
static int |
SIZE_TIMESTAMP |
static int |
SIZE_TIMESTAMP_NOFRAC |
ojiOracleDatumWithConnection, targetDatum| Constructor and Description |
|---|
TIMESTAMP()
Constructs a TIMESTAMP object initialized to 1/1/1970.
|
TIMESTAMP(byte[] timestamp)
Create an Oracle TIMESTAMP object represented by the given
Oracle Timestamp
|
TIMESTAMP(java.sql.Date date)
Create an Oracle TIMESTAMP object represented by the Java Date
|
TIMESTAMP(DATE date)
Create an Oracle TIMESTAMP object represented by the Oracle DATE
|
TIMESTAMP(java.time.LocalDate ld)
Create a TIMESTAMP object given a Java LocalDate
|
TIMESTAMP(java.time.LocalDateTime ldt)
Create a TIMESTAMP object given a Java LocalDateTime
|
TIMESTAMP(java.time.LocalTime lt)
Create a TIMESTAMP object given a Java LocalTime
|
TIMESTAMP(java.time.OffsetDateTime odt)
Create a TIMESTAMP object given a Java OffsetDateTime
|
TIMESTAMP(java.time.OffsetTime ot)
Create a TIMESTAMP object given a Java OffsetTime
|
TIMESTAMP(java.lang.String str)
Create a TIMESTAMP object given a Java String object.
|
TIMESTAMP(java.sql.Time time)
Create an Oracle TIMESTAMP object represented by the given Java Time
|
TIMESTAMP(java.sql.Timestamp timestamp)
Create an Oracle TIMESTAMP object represented by the Java Timestamp
|
TIMESTAMP(java.sql.Timestamp timestamp,
java.util.Calendar cal)
Create an Oracle TIMESTAMP object represented by the Java Timestamp
and Calendar
|
TIMESTAMP(java.time.ZonedDateTime zdt)
Create a TIMESTAMP object given a Java ZonedDateTime
|
| Modifier and Type | Method and Description |
|---|---|
java.sql.Date |
dateValue()
Calls toDate to convert internal Oracle TIMESTAMP to a Java Date.
|
static int |
getJavaYear(int cent,
int decade) |
static int |
getOracleYear(java.util.Calendar cal) |
static int |
getOracleYear(int jYear) |
boolean |
isConvertibleTo(java.lang.Class<?> cls)
Determines if the object can be converted to a particular class
|
java.time.LocalDateTime |
localDateTimeValue()
Converts TIMESTAMP to LocalDateTime.
|
java.time.LocalDate |
localDateValue()
Converts TIMESTAMP to LocalDate.
|
java.time.LocalTime |
localTimeValue()
Converts TIMESTAMP to LocalTime.
|
java.lang.Object |
makeJdbcArray(int arraySize)
Returns a JDBC array representation of the datum
|
static TIMESTAMP |
of(java.time.LocalDate ld)
Creates TIMESTAMP from the LocalDate.
|
static TIMESTAMP |
of(java.time.LocalDateTime ldt)
Creates TIMESTAMP from the LocalDateTime.
|
static TIMESTAMP |
of(java.time.LocalTime lt)
Creates TIMESTAMP from the LocalTime.
|
static TIMESTAMP |
of(java.time.OffsetDateTime odt)
Create a TIMESTAMP object given a Java OffsetDateTime
|
static TIMESTAMP |
of(java.time.OffsetTime ot)
Create a TIMESTAMP object given a Java OffsetTime
|
static TIMESTAMP |
of(java.time.ZonedDateTime zdt)
Create a TIMESTAMP object given a Java ZonedDateTime
|
java.lang.String |
stringValue()
Calls toString to convert internal Oracle TIMESTAMP to a Java String.
|
java.sql.Timestamp |
timestampValue()
Calls toTimestamp to convert internal Oracle TIMESTAMP to a Java Timestamp.
|
java.sql.Timestamp |
timestampValue(java.util.Calendar cal)
Calls toTimestamp to convert internal Oracle TIMESTAMP and Calendar
to a Java Timestamp.
|
java.sql.Time |
timeValue()
Calls toTime to convert internal Oracle Date to a Java Time.
|
static TIMESTAMP |
TimeZoneConvert(java.sql.Connection conn,
TIMESTAMP tstamp,
java.util.TimeZone tz1,
java.util.TimeZone tz2)
Converts the TIMESTAMP object from one timezone to the other
|
byte[] |
toBytes()
Convert Oracle TIMESTAMP object into a byte array
|
static byte[] |
toBytes(java.sql.Date date)
Convert Java Date to Oracle TIMESTAMP.
|
static byte[] |
toBytes(DATE date)
Convert Oracle DATE to Oracle TIMESTAMP
|
static byte[] |
toBytes(java.time.LocalDate ld)
Convert Java LocalDate to Oracle TIMESTAMP
|
static byte[] |
toBytes(java.time.LocalDateTime ldt)
Convert Java LocalDateTime to Oracle TIMESTAMP
|
static byte[] |
toBytes(java.time.LocalTime lt)
Convert Java LocalTime to Oracle TIMESTAMP
|
static byte[] |
toBytes(java.time.OffsetDateTime odt)
Convert Java OffsetDateTime to Oracle TIMESTAMP
|
static byte[] |
toBytes(java.time.OffsetTime ot)
Convert Java OffsetTime to Oracle TIMESTAMP
|
static byte[] |
toBytes(java.lang.String str)
Convert Java String to Oracle TIMESTAMP.
|
static byte[] |
toBytes(java.sql.Time time)
Convert Java Time to Oracle TIMESTAMP.
|
static byte[] |
toBytes(java.sql.Timestamp timestamp)
Convert Java Timestamp to Oracle TIMESTAMP
|
static byte[] |
toBytes(java.sql.Timestamp timestamp,
java.util.Calendar cal)
Convert Java Timestamp and Java Calendar to Oracle TIMESTAMP
|
static byte[] |
toBytes(java.time.ZonedDateTime zdt)
Convert Java ZonedDateTime to Oracle TIMESTAMP
|
static java.sql.Date |
toDate(byte[] timestamp)
Convert a byte array representing a TIMESTAMP object to a
Java Date Object
|
static DATE |
toDATE(byte[] timestamp)
Convert a byte array representing a TIMESTAMP object to a
Oracle DATE Object
|
java.lang.Object |
toJdbc()
Returns the JDBC representation of the datum object
|
java.time.LocalDate |
toLocalDate()
Converts TIMESTAMP to LocalDate.
|
static java.time.LocalDate |
toLocalDate(byte[] timestamp)
Convert a byte array representing a TIMESTAMP object to a
Java LocalDate
|
java.time.LocalDateTime |
toLocalDateTime()
Converts TIMESTAMP to LocalDateTime.
|
static java.time.LocalDateTime |
toLocalDateTime(byte[] timestamp)
Convert a byte array representing a TIMESTAMP object to a
Java LocalDateTime
|
java.time.LocalTime |
toLocalTime()
Converts TIMESTAMP to LocalTime.
|
static java.time.LocalTime |
toLocalTime(byte[] timestamp)
Convert a byte array representing a TIMESTAMP object to a
Java LocalTime
|
java.lang.String |
toString() |
static java.lang.String |
toString(byte[] bytes)
Converts a TIMESTAMP to a string
|
static java.sql.Time |
toTime(byte[] timestamp)
Convert a byte array representing a TIMESTAMP object to a
Java Time Object
|
static java.sql.Timestamp |
toTimestamp(byte[] timestamp)
Convert a byte array representing a TIMESTAMP object to a
Java Timestamp Object
|
static java.sql.Timestamp |
toTimestamp(byte[] timestamp,
java.util.Calendar cal)
Convert a byte array representing a TIMESTAMP object to a
Java Timestamp Object given Calendar object
|
asciiStreamValue, bigDecimalValue, binaryStreamValue, booleanValue, bytesEqual, bytesHashCode, byteValue, characterStreamValue, compareBytes, doubleValue, equals, floatValue, getBytes, getConnectionDuringExceptionHandling, getLength, getStream, intValue, isNull, longValue, setBytes, setShareBytes, shareBytes, stringValue, timeValue, toClasspublic static final int SIZE_DATE
public static final int SIZE_TIMESTAMP
public static final int SIZE_TIMESTAMP_NOFRAC
public TIMESTAMP()
public TIMESTAMP(byte[] timestamp)
timestamp - Oracle TIMESTAMPpublic TIMESTAMP(java.sql.Time time)
time - Java Time objectpublic TIMESTAMP(java.sql.Date date)
date - Java Date objectpublic TIMESTAMP(java.sql.Timestamp timestamp)
timestamp - Java Timestamp objectpublic TIMESTAMP(java.sql.Timestamp timestamp,
java.util.Calendar cal)
timestamp - Java Timestamp objectcal - Java Util Calendar objectpublic TIMESTAMP(DATE date)
date - Oracle DATE objectpublic TIMESTAMP(java.lang.String str)
str - Java String objectpublic TIMESTAMP(java.time.OffsetDateTime odt)
odt - OffsetDateTime objectpublic TIMESTAMP(java.time.ZonedDateTime zdt)
zdt - ZonedDateTime objectpublic TIMESTAMP(java.time.LocalDateTime ldt)
zdt - LocalDateTime objectpublic TIMESTAMP(java.time.LocalTime lt)
lt - LocalTime objectpublic TIMESTAMP(java.time.LocalDate ld)
ld - LocalDate objectpublic TIMESTAMP(java.time.OffsetTime ot)
ot - OffsetTime objectpublic static java.sql.Date toDate(byte[] timestamp)
throws java.sql.SQLException
timestamp - Oracle TIMESTAMP objectjava.sql.SQLExceptionpublic static java.sql.Time toTime(byte[] timestamp)
throws java.sql.SQLException
timestamp - Oracle TIMESTAMP objectjava.sql.SQLExceptionpublic static java.sql.Timestamp toTimestamp(byte[] timestamp)
throws java.sql.SQLException
timestamp - Oracle TIMESTAMP objectjava.sql.SQLExceptionpublic static java.sql.Timestamp toTimestamp(byte[] timestamp,
java.util.Calendar cal)
throws java.sql.SQLException
timestamp - Oracle TIMESTAMP object to be convertedcal - java.utl.Calendar objectjava.sql.SQLExceptionpublic static DATE toDATE(byte[] timestamp) throws java.sql.SQLException
timestamp - Oracle TIMESTAMP objectjava.sql.SQLExceptionpublic java.sql.Timestamp timestampValue()
throws java.sql.SQLException
timestampValue in class Datumjava.sql.SQLExceptionpublic java.sql.Timestamp timestampValue(java.util.Calendar cal)
throws java.sql.SQLException
timestampValue in class Datumjava.sql.SQLExceptionpublic static java.lang.String toString(byte[] bytes)
toString in interface oracle.jdbc.internal.OracleTimestampdate - a byte arraypublic byte[] toBytes()
toBytes in interface oracle.jdbc.internal.OracleTimestamppublic static byte[] toBytes(java.sql.Time time)
time - java.sql.Time object to be converted.public static byte[] toBytes(java.sql.Date date)
date - java.sql.Date object to be converted.public static byte[] toBytes(java.sql.Timestamp timestamp)
Timestamp - java.sql.Timestamp object to be converted.public static byte[] toBytes(java.sql.Timestamp timestamp,
java.util.Calendar cal)
Timestamp - java.sql.Timestamp object to be converted.Calendar - java.util.Calendar object to be converted.public static byte[] toBytes(DATE date)
date - oracle.sql.Timestamp object to be converted.public static byte[] toBytes(java.lang.String str)
toBytes in interface oracle.jdbc.internal.OracleTimestampstr - java.lang.String object to be converted.public java.lang.Object toJdbc()
throws java.sql.SQLException
public java.lang.Object makeJdbcArray(int arraySize)
makeJdbcArray in class DatumarraySize - size of the arraypublic boolean isConvertibleTo(java.lang.Class<?> cls)
isConvertibleTo in class Datumcls - Class to convert topublic static TIMESTAMP TimeZoneConvert(java.sql.Connection conn, TIMESTAMP tstamp, java.util.TimeZone tz1, java.util.TimeZone tz2) throws java.sql.SQLException
conn - Java Connection object
tstamp TIMESTAMP object to be converted
tz1 Source timezone
tz2 Destination timezonejava.sql.SQLExceptionpublic java.lang.String stringValue()
stringValue in class Datumpublic java.lang.String toString()
toString in class java.lang.Objectpublic static int getOracleYear(java.util.Calendar cal)
public static int getOracleYear(int jYear)
public java.sql.Date dateValue()
throws java.sql.SQLException
public java.sql.Time timeValue()
throws java.sql.SQLException
public static int getJavaYear(int cent,
int decade)
public static TIMESTAMP of(java.time.LocalDateTime ldt) throws java.sql.SQLException
ldt - LocalDateTime objectjava.sql.SQLExceptionpublic java.time.LocalDateTime toLocalDateTime()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.time.LocalDateTime localDateTimeValue()
throws java.sql.SQLException
java.sql.SQLExceptionpublic static TIMESTAMP of(java.time.OffsetDateTime odt)
odt - OffsetDateTime objectpublic static java.time.LocalDateTime toLocalDateTime(byte[] timestamp)
throws java.sql.SQLException
timestamp - Oracle TIMESTAMP object to be convertedjava.sql.SQLExceptionpublic static java.time.LocalTime toLocalTime(byte[] timestamp)
throws java.sql.SQLException
timestamp - Oracle TIMESTAMP object to be convertedjava.sql.SQLExceptionpublic static java.time.LocalDate toLocalDate(byte[] timestamp)
throws java.sql.SQLException
timestamp - Oracle TIMESTAMP object to be convertedjava.sql.SQLExceptionpublic static TIMESTAMP of(java.time.ZonedDateTime zdt)
zdt - ZonedDateTime objectpublic static TIMESTAMP of(java.time.OffsetTime ot)
ot - OffsetTime objectpublic static TIMESTAMP of(java.time.LocalTime lt) throws java.sql.SQLException
lt - LocalTime objectjava.sql.SQLExceptionpublic java.time.LocalTime toLocalTime()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.time.LocalTime localTimeValue()
throws java.sql.SQLException
java.sql.SQLExceptionpublic static TIMESTAMP of(java.time.LocalDate ld) throws java.sql.SQLException
ld - LocalDate objectjava.sql.SQLExceptionpublic java.time.LocalDate toLocalDate()
throws java.sql.SQLException
java.sql.SQLExceptionpublic java.time.LocalDate localDateValue()
throws java.sql.SQLException
java.sql.SQLExceptionpublic static byte[] toBytes(java.time.OffsetDateTime odt)
odt - OffsetDateTime objectpublic static byte[] toBytes(java.time.ZonedDateTime zdt)
zdt - ZonedDateTime objectpublic static byte[] toBytes(java.time.OffsetTime ot)
ot - OffsetTime objectpublic static byte[] toBytes(java.time.LocalDate ld)
ld - LocalDate objectpublic static byte[] toBytes(java.time.LocalDateTime ldt)
ldt - LocalDateTime objectpublic static byte[] toBytes(java.time.LocalTime lt)
lt - LocalTime object