Serializable
, oracle.jdbc.internal.OracleTimestamp
public class TIMESTAMP extends Datum implements 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 | Description |
---|---|---|
static int |
SIZE_DATE |
|
static int |
SIZE_TIMESTAMP |
|
static int |
SIZE_TIMESTAMP_NOFRAC |
ojiOracleDatumWithConnection, targetDatum
Constructor | 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(String str) |
Create a TIMESTAMP object given a Java String object.
|
TIMESTAMP(Date date) |
Create an Oracle TIMESTAMP object represented by the Java Date
|
TIMESTAMP(Time time) |
Create an Oracle TIMESTAMP object represented by the given Java Time
|
TIMESTAMP(Timestamp timestamp) |
Create an Oracle TIMESTAMP object represented by the Java Timestamp
|
TIMESTAMP(Timestamp timestamp, Calendar cal) |
Create an Oracle TIMESTAMP object represented by the Java Timestamp and Calendar
|
TIMESTAMP(DATE date) |
Create an Oracle TIMESTAMP object represented by the Oracle DATE
|
Modifier and Type | Method | Description |
---|---|---|
Date |
dateValue() |
Calls toDate to convert internal Oracle TIMESTAMP to a Java Date.
|
static int |
getJavaYear(int cent, int decade) |
|
static int |
getOracleYear(Calendar cal) |
|
boolean |
isConvertibleTo(Class cls) |
Determines if the object can be converted to a particular class
|
Object |
makeJdbcArray(int arraySize) |
Returns a JDBC array representation of the datum
|
String |
stringValue() |
Calls toString to convert internal Oracle TIMESTAMP to a Java String.
|
Timestamp |
timestampValue() |
Calls toTimestamp to convert internal Oracle TIMESTAMP to a Java Timestamp.
|
Timestamp |
timestampValue(Calendar cal) |
Calls toTimestamp to convert internal Oracle TIMESTAMP and Calendar to a Java Timestamp.
|
Time |
timeValue() |
Calls toTime to convert internal Oracle Date to a Java Time.
|
static TIMESTAMP |
TimeZoneConvert(Connection conn, TIMESTAMP tstamp, TimeZone tz1, 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(String str) |
Convert Java String to Oracle TIMESTAMP.
|
static byte[] |
toBytes(Date date) |
Convert Java Date to Oracle TIMESTAMP.
|
static byte[] |
toBytes(Time time) |
Convert Java Time to Oracle TIMESTAMP.
|
static byte[] |
toBytes(Timestamp timestamp) |
Convert Java Timestamp to Oracle TIMESTAMP
|
static byte[] |
toBytes(Timestamp timestamp, Calendar cal) |
Convert Java Timestamp and Java Calendar to Oracle TIMESTAMP
|
static byte[] |
toBytes(DATE date) |
Convert Oracle DATE to Oracle TIMESTAMP
|
static 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
|
Object |
toJdbc() |
Returns the JDBC representation of the datum object
|
String |
toString() |
|
static String |
toString(byte[] bytes) |
Converts a TIMESTAMP to a string
|
static Time |
toTime(byte[] timestamp) |
Convert a byte array representing a TIMESTAMP object to a Java Time Object
|
static Timestamp |
toTimestamp(byte[] timestamp) |
Convert a byte array representing a TIMESTAMP object to a Java Timestamp Object
|
static Timestamp |
toTimestamp(byte[] timestamp, 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, toClass
public 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(Time time)
time
- Java Time objectpublic TIMESTAMP(Date date)
date
- Java Date objectpublic TIMESTAMP(Timestamp timestamp)
timestamp
- Java Timestamp objectpublic TIMESTAMP(Timestamp timestamp, Calendar cal)
timestamp
- Java Timestamp objectcal
- Java Util Calendar objectpublic TIMESTAMP(DATE date)
date
- Oracle DATE objectpublic TIMESTAMP(String str)
str
- Java String objectpublic static Date toDate(byte[] timestamp) throws SQLException
timestamp
- Oracle TIMESTAMP objectSQLException
public static Time toTime(byte[] timestamp) throws SQLException
timestamp
- Oracle TIMESTAMP objectSQLException
public static Timestamp toTimestamp(byte[] timestamp) throws SQLException
timestamp
- Oracle TIMESTAMP objectSQLException
public static Timestamp toTimestamp(byte[] timestamp, Calendar cal) throws SQLException
timestamp
- Oracle TIMESTAMP object to be convertedcal
- java.utl.Calendar objectSQLException
public static DATE toDATE(byte[] timestamp) throws SQLException
timestamp
- Oracle TIMESTAMP objectSQLException
public Timestamp timestampValue() throws SQLException
timestampValue
in class Datum
SQLException
public Timestamp timestampValue(Calendar cal) throws SQLException
timestampValue
in class Datum
SQLException
public static String toString(byte[] bytes)
date
- a byte arraypublic byte[] toBytes()
toBytes
in interface oracle.jdbc.internal.OracleTimestamp
public static byte[] toBytes(Time time)
time
- java.sql.Time object to be converted.public static byte[] toBytes(Date date)
date
- java.sql.Date object to be converted.public static byte[] toBytes(Timestamp timestamp)
Timestamp
- java.sql.Timestamp object to be converted.public static byte[] toBytes(Timestamp timestamp, 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(String str)
str
- java.lang.String object to be converted.public Object toJdbc() throws SQLException
toJdbc
in class Datum
SQLException
- if conversion to JDBC representation results in an errorpublic Object makeJdbcArray(int arraySize)
makeJdbcArray
in class Datum
arraySize
- size of the arraypublic boolean isConvertibleTo(Class cls)
isConvertibleTo
in class Datum
cls
- Class to convert topublic static TIMESTAMP TimeZoneConvert(Connection conn, TIMESTAMP tstamp, TimeZone tz1, TimeZone tz2) throws SQLException
conn
- Java Connection object tstamp TIMESTAMP object to be converted tz1 Source timezone tz2 Destination timezoneSQLException
public String stringValue()
stringValue
in class Datum
public static int getOracleYear(Calendar cal)
public Date dateValue() throws SQLException
dateValue
in class Datum
SQLException
public Time timeValue() throws SQLException
timeValue
in class Datum
SQLException
public static int getJavaYear(int cent, int decade)