Documentation of 'org.apache.derby.client.am.DateTime' Java class
DateTime
org.apache.derby.client.am

Class DateTime



  • public class DateTime
    extends java.lang.Object
    High performance converters from date/time byte encodings to JDBC Date, Time and Timestamp objects.

    Using this class for direct date/time conversions from bytes offers superior performance over the alternative method of first constructing a Java String from the encoded bytes, and then using java.sql.Date.valueOf(), java.sql.Time.valueOf() or java.sql.Timestamp.valueOf().

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static int dateToDateBytes(byte[] buffer, int offset, DateTimeValue date)
      Date is converted to a char representation in JDBC date format: yyyy-mm-dd date format and then converted to bytes using UTF8 encoding
      static int getTimestampLength(boolean supportsTimestampNanoseconds)
      Return the length of a timestamp depending on whether timestamps should have full nanosecond precision or be truncated to just microseconds.
      static int timestampToTimestampBytes(byte[] buffer, int offset, DateTimeValue timestamp, boolean supportsTimestampNanoseconds)
      See getTimestampLength() for an explanation of how timestamps are formatted.
      static int timeToTimeBytes(byte[] buffer, int offset, DateTimeValue time)
      java.sql.Time is converted to character representation which is in JDBC time escape format: hh:mm:ss, which is the same as JIS time format in DERBY string representation of a time.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • dateToDateBytes

        public static final int dateToDateBytes(byte[] buffer,
                                                int offset,
                                                DateTimeValue date)
                                         throws SqlException
        Date is converted to a char representation in JDBC date format: yyyy-mm-dd date format and then converted to bytes using UTF8 encoding
        Parameters:
        buffer - bytes in UTF8 encoding of the date
        offset - write into the buffer from this offset
        date - date value
        Returns:
        DateTime.dateRepresentationLength. This is the fixed length in bytes taken to represent the date value
        Throws:
        SqlException
      • timeToTimeBytes

        public static final int timeToTimeBytes(byte[] buffer,
                                                int offset,
                                                DateTimeValue time)
        java.sql.Time is converted to character representation which is in JDBC time escape format: hh:mm:ss, which is the same as JIS time format in DERBY string representation of a time. The char representation is converted to bytes using UTF8 encoding.
        Parameters:
        buffer - bytes in UTF8 encoding of the time
        offset - write into the buffer from this offset
        time - java.sql.Time value
        Returns:
        DateTime.timeRepresentationLength. This is the fixed length in bytes taken to represent the time value
      • timestampToTimestampBytes

        public static final int timestampToTimestampBytes(byte[] buffer,
                                                          int offset,
                                                          DateTimeValue timestamp,
                                                          boolean supportsTimestampNanoseconds)
                                                   throws SqlException
        See getTimestampLength() for an explanation of how timestamps are formatted.
        Parameters:
        buffer - bytes in UTF8 encoding of the timestamp
        offset - write into the buffer from this offset
        timestamp - timestamp value
        supportsTimestampNanoseconds - true if the server supports nanoseconds in timestamps
        Returns:
        DateTime.timestampRepresentationLength. This is the fixed length in bytes, taken to represent the timestamp value
        Throws:
        SqlException
      • getTimestampLength

        public static int getTimestampLength(boolean supportsTimestampNanoseconds)
        Return the length of a timestamp depending on whether timestamps should have full nanosecond precision or be truncated to just microseconds. java.sql.Timestamp is converted to a character representation which is a DERBY string representation of a timestamp converted to bytes using UTF8 encoding. For Derby 10.6 and above, this is yyyy-mm-dd-hh.mm.ss.fffffffff. For Derby 10.5 and below, this is yyyy-mm-dd-hh.mm.ss.ffffff. See DERBY-2602. and then converted to bytes using UTF8 encoding
        Parameters:
        supportsTimestampNanoseconds - true if the connection supports nanoseconds in timestamps

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.