Package oracle.sql
Class TIMESTAMPTZ
java.lang.Object
oracle.sql.Datum
oracle.sql.TIMESTAMPTZ
- All Implemented Interfaces:
Serializable,oracle.jdbc.internal.OracleTimestampWithTimeZone
TIMESTAMPTZ Class
The TIMESTAMPTZ 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 thirteen 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 (Most Significant bit)
8 Nanoseconds
9 Nanoseconds
10 Nanoseconds (Least Significant Bit)
11,12 Region id or Timezone Hour/Minute
The timezone information is stored as an offset in the RegionID format or
in the HOUR/MINUTE format
Static methods are used for conversions.
- See Also:
-
Field Summary
Fields inherited from class oracle.sql.Datum
ojiOracleDatumWithConnection, targetDatum -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a TIMESTAMPTZ object initialized to 1/1/1970.TIMESTAMPTZ(byte[] timestamptz) Create an Oracle TIMESTAMPTZ object represented by the given Oracle TimestamptzTIMESTAMPTZ(Connection conn, String str) Create a TIMESTAMPTZ object given a Java String object.TIMESTAMPTZ(Connection conn, String str, Calendar cal) Create a TIMESTAMPTZ object given a Java String object.TIMESTAMPTZ(Connection conn, Date date) Create an Oracle TIMESTAMPTZ object represented by the Java DateTIMESTAMPTZ(Connection conn, Date date, Calendar cal) Create an Oracle TIMESTAMPTZ object represented by the Java Date and the Java Calendar objectTIMESTAMPTZ(Connection conn, Time time) Create an Oracle TIMESTAMPTZ object represented by the given Java TimeTIMESTAMPTZ(Connection conn, Time time, Calendar cal) Create an Oracle TIMESTAMPTZ object represented by the given Java Time and the Java Calendar objectTIMESTAMPTZ(Connection conn, Timestamp timestamp) Create an Oracle TIMESTAMPTZ object represented by the Java TimestampTIMESTAMPTZ(Connection conn, Timestamp timestamp, ZoneId tzid) Create an Oracle TIMESTAMPTZ object represented by the Java Timestamp with the specified ZoneId.TIMESTAMPTZ(Connection conn, Timestamp timestamp, Calendar cal) Create an Oracle TIMESTAMPTZ object represented by the Java Timestamp and the Java Calendar objectTIMESTAMPTZ(Connection conn, LocalDateTime ldt) Create a TIMESTAMPTZ object given a Java LocalDateTime object.TIMESTAMPTZ(Connection conn, DATE date) Create an Oracle TIMESTAMPTZ object represented by the Oracle DATECreate a TIMESTAMPTZ object given a Java OffsetDateTime object.Create a TIMESTAMPTZ object given a Java OffsetTime object.TIMESTAMPTZ(ZonedDateTime zdt) Create a TIMESTAMPTZ object given a Java ZonedDateTime object. -
Method Summary
Modifier and TypeMethodDescriptiondateValue(Connection conn) Calls toDate to convert internal Oracle TIMESTAMPTZ to a Java Date.booleanisConvertibleTo(Class<?> cls) Determines if the object can be converted to a particular classCalls toLocalDateTime to convert internal Oracle TIMESTAMPTZ to a Java LocalDateTime.makeJdbcArray(int arraySize) Returns a JDBC array representation of the datumstatic TIMESTAMPTZof(Connection conn, LocalDateTime ldt) Creates TIMESTAMPTZ from the LocalDateTime.static TIMESTAMPTZof(OffsetDateTime odt) Creates TIMESTAMPTZ from the OffsetDateTime.static TIMESTAMPTZof(ZonedDateTime zdt) Creates TIMESTAMPTZ from the ZonedDateTime.Calls toOffsetDateTime to convert internal Oracle TIMESTAMPTZ to a Java OffsetDateTime without a connection object.Calls toOffsetDateTime to convert internal Oracle TIMESTAMPTZ to a Java OffsetDateTime with a connection object.stringValue(Connection conn) Calls toString to convert internal Oracle TIMESTAMPTZ to a Java String.timestampValue(Connection conn) Calls toTimestamp to convert internal Oracle Date to a Java Timestamp.timeValue(Connection conn) Calls toTime to convert internal Oracle Date to a Java Time.byte[]toBytes()Convert Oracle Timestamptz object into a byte arraystatic byte[]toBytes(Connection conn, String str) Convert Java String to Oracle TIMESTAMPTZ.static byte[]toBytes(Connection conn, String str, Calendar cal) Convert Java String to Oracle TIMESTAMPTZ.static byte[]toBytes(Connection conn, Date date) Convert Java Date to Oracle TIMESTAMPTZ.static byte[]toBytes(Connection conn, Date date, Calendar cal) Convert Java Date to Oracle TIMESTAMPTZ.static byte[]toBytes(Connection conn, Time time) Convert Java Time to Oracle TIMESTAMPTZ.static byte[]toBytes(Connection conn, Time time, Calendar cal) Convert Java Time to Oracle TIMESTAMPTZ.static byte[]toBytes(Connection conn, Timestamp timestamp) Convert Java Timestamp to Oracle TIMESTAMPTZstatic byte[]toBytes(Connection conn, Timestamp timestamp, ZoneId tzid) Convert Java Timestamp to Oracle TIMESTAMPTZstatic byte[]toBytes(Connection conn, Timestamp timestamp, Calendar cal) Convert Java Timestamp to Oracle TIMESTAMPTZstatic byte[]toBytes(Connection conn, LocalDateTime ldt) Convert Java LocalDateTime to Oracle TIMESTAMPTZ.static byte[]toBytes(Connection conn, DATE date) Convert Oracle DATE to Oracle TIMESTAMPTZstatic byte[]toBytes(OffsetDateTime odt) Convert Java OffsetDateTime to Oracle TIMESTAMPTZ.static byte[]toBytes(OffsetTime ot) Convert Java OffsetTime to Oracle TIMESTAMPTZ.static byte[]toBytes(ZonedDateTime zdt) Convert Java ZonedDateTime to Oracle TIMESTAMPTZ.static DatetoDate(Connection conn, byte[] timestamptz) Convert a byte array representing a TIMESTAMPTZ object to a Java Date Objectstatic DATEtoDATE(Connection conn, byte[] timestamptz) Convert a byte array representing a TIMESTAMPTZ object to a Oracle DATE Objectstatic DatetoDate2(Connection conn, byte[] timestamptz) Convert a byte array representing a TIMESTAMPTZ object to a Java Date Object in accordance with java.sql.Date specification.toJdbc()Returns the JDBC representation of the timestamptz objectConverts TIMESTAMPTZ to LocalDateTime.static LocalDateTimetoLocalDateTime(byte[] timestamptz) Converts TIMESTAMPTZ to LocalDateTime.Converts TIMESTAMPTZ to OffsetDateTime.static OffsetDateTimetoOffsetDateTime(Connection conn, byte[] timestamptz) Converts a TIMESTAMPTZ to an OffsetDateTimeConverts a TIMESTAMPTZ to an OffsetTimestatic StringtoString(Connection conn, byte[] timestamptz) Converts a TIMESTAMPTZ to a stringstatic TimetoTime(Connection conn, byte[] timestamptz) Convert a byte array representing a TIMESTAMPTZ object to a Java Time Objectstatic TimestamptoTimestamp(Connection conn, byte[] timestamptz) Convert a byte array representing a TIMESTAMP WITH TIME ZONE object to a Java Timestamp Objectstatic TIMESTAMPtoTIMESTAMP(Connection conn, byte[] timestamptz) Convert a byte array representing a TIMESTAMPTZ object to a Oracle TIMESTAMP Objectstatic TimestamptoTimestamp2(Connection conn, byte[] timestamptz) Convert a byte array representing a TIMESTAMPTZ object to a Java Timestamp ObjectConverts TIMESTAMPTZ to ZonedDateTime.static ZonedDateTimetoZonedDateTime(byte[] timestamptz) Converts TIMESTAMPTZ to ZonedDateTime.Calls toZonedDateTime to convert internal Oracle TIMESTAMPTZ to a Java ZonedDateTime.Methods inherited from class oracle.sql.Datum
asciiStreamValue, bigDecimalValue, binaryStreamValue, booleanValue, bytesEqual, bytesHashCode, byteValue, characterStreamValue, compareBytes, dateValue, doubleValue, equals, floatValue, getBytes, getConnectionDuringExceptionHandling, getLength, getStream, intValue, isNull, longValue, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timestampValue, timeValue, timeValue, toClass
-
Constructor Details
-
TIMESTAMPTZ
public TIMESTAMPTZ()Constructs a TIMESTAMPTZ object initialized to 1/1/1970. -
TIMESTAMPTZ
public TIMESTAMPTZ(byte[] timestamptz) Create an Oracle TIMESTAMPTZ object represented by the given Oracle Timestamptz- Parameters:
timestamptz- Oracle TIMESTAMPTZ
-
TIMESTAMPTZ
Create an Oracle TIMESTAMPTZ object represented by the Java Date- Parameters:
conn- JDBC connection date Java Date object- Throws:
SQLException
-
TIMESTAMPTZ
Create an Oracle TIMESTAMPTZ object represented by the Java Date and the Java Calendar object- Parameters:
conn- JDBC connection date Java Date object cal java Calendar object- Throws:
SQLException
-
TIMESTAMPTZ
Create an Oracle TIMESTAMPTZ object represented by the given Java Time- Parameters:
conn- JDBC connection time Java Time object- Throws:
SQLException
-
TIMESTAMPTZ
Create an Oracle TIMESTAMPTZ object represented by the given Java Time and the Java Calendar object- Parameters:
conn- JDBC connection time Java Time object cal java Calendar object- Throws:
SQLException
-
TIMESTAMPTZ
Create an Oracle TIMESTAMPTZ object represented by the Java Timestamp- Parameters:
conn- JDBC connection timestamp Java Timestamp object- Throws:
SQLException
-
TIMESTAMPTZ
Create an Oracle TIMESTAMPTZ object represented by the Java Timestamp and the Java Calendar object- Parameters:
conn- JDBC connection timestamp Java Timestamp object cal Java Calendar object- Throws:
SQLException
-
TIMESTAMPTZ
Create an Oracle TIMESTAMPTZ object represented by the Java Timestamp with the specified ZoneId.- Parameters:
conn- JDBC connection timestamp Java Timestamp object tzidstamp Java ZoneId object- Throws:
SQLException
-
TIMESTAMPTZ
Create an Oracle TIMESTAMPTZ object represented by the Oracle DATE- Parameters:
conn- JDBC connection date Oracle DATE object- Throws:
SQLException
-
TIMESTAMPTZ
Create a TIMESTAMPTZ object given a Java String object.- Parameters:
conn- JDBC connection str Java String object- Throws:
SQLException
-
TIMESTAMPTZ
Create a TIMESTAMPTZ object given a Java String object.- Parameters:
conn- JDBC connection str Java String object cal Calendar object encapsulating the timezone- Throws:
SQLException
-
TIMESTAMPTZ
Create a TIMESTAMPTZ object given a Java OffsetDateTime object.- Parameters:
odt- OffsetDateTime object- Throws:
SQLException
-
TIMESTAMPTZ
Create a TIMESTAMPTZ object given a Java ZonedDateTime object.- Parameters:
zdt- ZonedDateTime object- Throws:
SQLException
-
TIMESTAMPTZ
Create a TIMESTAMPTZ object given a Java LocalDateTime object.- Parameters:
ldt- LocalDateTime object- Throws:
SQLException
-
TIMESTAMPTZ
Create a TIMESTAMPTZ object given a Java OffsetTime object.- Parameters:
ot- OffsetTime object- Throws:
SQLException
-
-
Method Details
-
toDate
Convert a byte array representing a TIMESTAMPTZ object to a Java Date Object- Parameters:
conn- JDBC connection timestamptz Oracle TIMESTAMPTZ object- Returns:
- the Java Date object represented by Oracle TIMESTAMPTZ object
- Throws:
SQLException
-
toDate2
Convert a byte array representing a TIMESTAMPTZ object to a Java Date Object in accordance with java.sql.Date specification.- Parameters:
conn- JDBC connection timestamptz Oracle TIMESTAMPTZ object in byte array- Returns:
- the Java Date object represented by Oracle TIMESTAMPTZ object as per java.sql.Date standards. i.e w.r.t GMT timezone
- Throws:
SQLException
-
toTime
Convert a byte array representing a TIMESTAMPTZ object to a Java Time Object- Parameters:
conn- JDBC connection timestamptz Oracle TIMESTAMPTZ object- Returns:
- the java.sql.Time object represented by Oracle TIMESTAMPTZ object. Only the hour, minute and seconds are contained in the java.sql.Time object that is returned and hence callers should not attempt to access the date component of the returned object.
- Throws:
SQLException
-
toDATE
Convert a byte array representing a TIMESTAMPTZ object to a Oracle DATE Object- Parameters:
conn- JDBC connection timestamptz Oracle TIMESTAMPTZ object- Returns:
- the oracle DATE object represented by Oracle TIMESTAMPTZ object
- Throws:
SQLException
-
toTIMESTAMP
Convert a byte array representing a TIMESTAMPTZ object to a Oracle TIMESTAMP Object- Parameters:
conn- JDBC connection timestamptz Oracle TIMESTAMPTZ object- Returns:
- the Oracle TIMESTAMP object represented by Oracle TIMESTAMPTZ object
- Throws:
SQLException
-
toTimestamp
Convert a byte array representing a TIMESTAMP WITH TIME ZONE object to a Java Timestamp Object- Parameters:
conn- JDBC connection timestamptz Oracle TIMESTAMPTZ object- Returns:
- the Java Timestamp object represented by Oracle TIMESTAMPTZ object
- Throws:
SQLException
-
toTimestamp2
Convert a byte array representing a TIMESTAMPTZ object to a Java Timestamp Object- Parameters:
conn- JDBC connection timestamptz Oracle TIMESTAMPTZ object- Returns:
- the Java Timestamp object represented by Oracle TIMESTAMPTZ object
- Throws:
SQLException
-
toString
Converts a TIMESTAMPTZ to a string- Parameters:
timestamptz- a byte array- Returns:
- String representing the TIMESTAMPTZ
- Throws:
SQLException
-
toOffsetDateTime
public static OffsetDateTime toOffsetDateTime(Connection conn, byte[] timestamptz) throws SQLException Converts a TIMESTAMPTZ to an OffsetDateTime- Parameters:
timestamptz- a byte array- Returns:
- OffsetDateTime representing the TIMESTAMPTZ
- Throws:
SQLException
-
timestampValue
Calls toTimestamp to convert internal Oracle Date to a Java Timestamp.- Returns:
- a Java Timestamp value
- Throws:
SQLException
-
toBytes
public byte[] toBytes()Convert Oracle Timestamptz object into a byte array- Specified by:
toBytesin interfaceoracle.jdbc.internal.OracleTimestampWithTimeZone- Returns:
- the byte array stored in the TIMESTAMPTZ object
-
toBytes
Convert Java Date to Oracle TIMESTAMPTZ.- Parameters:
conn- JDBC connection date Java Date object- Returns:
- the byte array representing the java Date.
- Throws:
SQLException
-
toBytes
Convert Java Date to Oracle TIMESTAMPTZ.- Parameters:
conn- JDBC connection date Java Date object cal java Calendar object- Returns:
- the byte array representing the java Date.
- Throws:
SQLException
-
toBytes
Convert Java Time to Oracle TIMESTAMPTZ.- Parameters:
conn- JDBC connection time Java Time object- Returns:
- the byte array representing the java Time.
- Throws:
SQLException
-
toBytes
Convert Java Time to Oracle TIMESTAMPTZ.- Parameters:
conn- JDBC connection time Java Time object cal java Calendar object- Returns:
- the byte array representing the java Time.
- Throws:
SQLException
-
toBytes
Convert Java Timestamp to Oracle TIMESTAMPTZ- Parameters:
conn- JDBC connection timestamp Java Timestamp object- Returns:
- the byte array representing the TIMESTAMPTZ object.
- Throws:
SQLException
-
toBytes
public static byte[] toBytes(Connection conn, Timestamp timestamp, Calendar cal) throws SQLException Convert Java Timestamp to Oracle TIMESTAMPTZ- Parameters:
conn- JDBC connection timestamp Java Timestamp object cal Java Calendar object- Returns:
- the byte array representing the TIMESTAMPTZ object.
- Throws:
SQLException
-
toBytes
Convert Java Timestamp to Oracle TIMESTAMPTZ- Parameters:
conn- JDBC connection timestamp Java Timestamp object tzid Java ZoneId object- Returns:
- the byte array representing the TIMESTAMPTZ object.
- Throws:
SQLException
-
toBytes
Convert Oracle DATE to Oracle TIMESTAMPTZ- Parameters:
conn- JDBC connection date Oracle DATE object- Returns:
- the byte array representing the Oracle TIMESTAMPTZ.
- Throws:
SQLException
-
toBytes
Convert Java String to Oracle TIMESTAMPTZ.- Parameters:
conn- JDBC Connection str java.lang.String object to be converted.- Returns:
- the byte array representing the input string.
- Throws:
SQLException
-
toBytes
Convert Java String to Oracle TIMESTAMPTZ.- Parameters:
conn- JDBC Connection str java.lang.String object to be converted. cal Calendar object encapsulating the timezone- Returns:
- the byte array representing the input string.
- Throws:
SQLException
-
stringValue
Calls toString to convert internal Oracle TIMESTAMPTZ to a Java String.- Specified by:
stringValuein interfaceoracle.jdbc.internal.OracleTimestampWithTimeZone- Overrides:
stringValuein classDatum- Parameters:
conn- oracle.JDBC.OracleConnection object- Returns:
- a Java String value
- Throws:
SQLException
-
toBytes
Convert Java OffsetDateTime to Oracle TIMESTAMPTZ.- Parameters:
odt- OffsetDateTime object- Returns:
- the byte array representing the java Date.
- Throws:
SQLException
-
toBytes
Convert Java ZonedDateTime to Oracle TIMESTAMPTZ.- Parameters:
zdt- ZonedDateTime object- Returns:
- the byte array representing the java Date.
- Throws:
SQLException
-
toBytes
Convert Java LocalDateTime to Oracle TIMESTAMPTZ.- Parameters:
zdt- LocalDateTime object- Returns:
- the byte array representing the java Date.
- Throws:
SQLException
-
toBytes
Convert Java OffsetTime to Oracle TIMESTAMPTZ.- Parameters:
ot- OffsetTime object- Returns:
- the byte array representing the java Date.
- Throws:
SQLException
-
offsetDateTimeValue
Calls toOffsetDateTime to convert internal Oracle TIMESTAMPTZ to a Java OffsetDateTime without a connection object.- Returns:
- a Java OffsetDateTime
- Throws:
SQLException
-
offsetDateTimeValue
Calls toOffsetDateTime to convert internal Oracle TIMESTAMPTZ to a Java OffsetDateTime with a connection object.- Parameters:
a- JDBC Connection object- Returns:
- a Java OffsetDateTime
- Throws:
SQLException
-
zonedDateTimeValue
Calls toZonedDateTime to convert internal Oracle TIMESTAMPTZ to a Java ZonedDateTime.- Returns:
- a Java ZonedDateTime
- Throws:
SQLException
-
localDateTimeValue
Calls toLocalDateTime to convert internal Oracle TIMESTAMPTZ to a Java LocalDateTime.- Returns:
- a Java LocalDateTime
- Throws:
SQLException
-
dateValue
Calls toDate to convert internal Oracle TIMESTAMPTZ to a Java Date.- Parameters:
a- JDBC Connection object- Returns:
- a Java Date
- Throws:
SQLException
-
timeValue
Calls toTime to convert internal Oracle Date to a Java Time.- Returns:
- a Java Time value
- Throws:
SQLException
-
getTimeZone
- Returns:
- the TimeZone of this value
- Throws:
SQLException
-
of
Creates TIMESTAMPTZ from the ZonedDateTime.- Parameters:
zdt- ZonedDateTime object- Returns:
- TIMESTAMPTZ object
- Throws:
SQLException
-
toZonedDateTime
Converts TIMESTAMPTZ to ZonedDateTime.- Returns:
- ZonedDateTime object.
- Throws:
SQLException
-
toLocalDateTime
Converts TIMESTAMPTZ to LocalDateTime.- Returns:
- LocalDateTime object.
- Throws:
SQLException
-
toLocalDateTime
Converts TIMESTAMPTZ to LocalDateTime.- Parameters:
timestamptz- TIMESTAMPTZ datum- Returns:
- LocalDateTime object.
- Throws:
SQLException
-
toZonedDateTime
Converts TIMESTAMPTZ to ZonedDateTime.- Returns:
- ZonedDateTime object.
- Throws:
SQLException
-
toOffsetTime
Converts a TIMESTAMPTZ to an OffsetTime- Parameters:
timestamptz- a byte array- Returns:
- OffsetTime representing the TIMESTAMPTZ
- Throws:
SQLException
-
of
Creates TIMESTAMPTZ from the OffsetDateTime.- Parameters:
odt- OffsetDateTime object- Returns:
- TIMESTAMPTZ object
- Throws:
SQLException
-
of
Creates TIMESTAMPTZ from the LocalDateTime.- Parameters:
conn- Connection objectldt- LocalDateTime object- Returns:
- TIMESTAMPTZ object
- Throws:
SQLException
-
toOffsetDateTime
Converts TIMESTAMPTZ to OffsetDateTime.- Returns:
- OffsetDateTime object.
- Throws:
SQLException
-
toJdbc
Returns the JDBC representation of the timestamptz object- Specified by:
toJdbcin classDatum- Returns:
- an object containing the JDBC value
- Throws:
SQLException- if conversion to JDBC representation results in an error
-
makeJdbcArray
Returns a JDBC array representation of the datum- Specified by:
makeJdbcArrayin classDatum- Parameters:
arraySize- size of the array- Returns:
- an object containing the JDBC array value
-
isConvertibleTo
Determines if the object can be converted to a particular class- Specified by:
isConvertibleToin classDatum- Parameters:
cls- Class to convert to- Returns:
- true, if conversion to cls is permitted false, if conversion to cls is not permitted
-