Class SQLDate

java.lang.Object
org.apache.derby.iapi.types.DataType
org.apache.derby.iapi.types.SQLDate
All Implemented Interfaces:
Externalizable, Serializable, Comparable, Formatable, Storable, TypedFormat, DataValueDescriptor, DateTimeDataValue, Orderable

public final class SQLDate extends DataType implements DateTimeDataValue
This contains an instance of a SQL Date.

The date is stored as int (year << 16 + month << 8 + day) Null is represented by an encodedDate value of 0. Some of the static methods in this class are also used by SQLTime and SQLTimestamp so check those classes if you change the date encoding PERFORMANCE OPTIMIZATION: The java.sql.Date object is only instantiated when needed do to the overhead of Date.valueOf(), etc. methods.

See Also:
  • Field Details

    • encodedDate

      private int encodedDate
    • BASE_MEMORY_USAGE

      private static final int BASE_MEMORY_USAGE
    • ISO_SEPARATOR

      static final char ISO_SEPARATOR
      See Also:
    • ISO_SEPARATOR_ONLY

      private static final char[] ISO_SEPARATOR_ONLY
    • IBM_USA_SEPARATOR

      private static final char IBM_USA_SEPARATOR
      See Also:
    • IBM_USA_SEPARATOR_ONLY

      private static final char[] IBM_USA_SEPARATOR_ONLY
    • IBM_EUR_SEPARATOR

      private static final char IBM_EUR_SEPARATOR
      See Also:
    • IBM_EUR_SEPARATOR_ONLY

      private static final char[] IBM_EUR_SEPARATOR_ONLY
    • END_OF_STRING

      private static final char[] END_OF_STRING
  • Constructor Details

    • SQLDate

      public SQLDate()
      no-arg constructor required by Formattable
    • SQLDate

      public SQLDate(Date value) throws StandardException
      Throws:
      StandardException
    • SQLDate

      private SQLDate(int encodedDate)
    • SQLDate

      public SQLDate(String dateStr, boolean isJdbcEscape, LocaleFinder localeFinder) throws StandardException
      Construct a date from a string. The allowed date formats are:
      1. ISO: yyyy-mm-dd
      2. IBM USA standard: mm/dd/yyyy
      3. IBM European standard: dd.mm.yyyy
      Trailing blanks may be included; leading zeros may be omitted from the month and day portions.
      Parameters:
      dateStr -
      isJdbcEscape - if true then only the JDBC date escape syntax is allowed
      localeFinder -
      Throws:
      StandardException - if the syntax is invalid or the value is out of range
    • SQLDate

      public SQLDate(String dateStr, boolean isJdbcEscape, LocaleFinder localeFinder, Calendar cal) throws StandardException
      Construct a date from a string. The allowed date formats are:
      1. ISO: yyyy-mm-dd
      2. IBM USA standard: mm/dd/yyyy
      3. IBM European standard: dd.mm.yyyy
      Trailing blanks may be included; leading zeros may be omitted from the month and day portions.
      Parameters:
      dateStr -
      isJdbcEscape - if true then only the JDBC date escape syntax is allowed
      localeFinder -
      Throws:
      StandardException - if the syntax is invalid or the value is out of range
  • Method Details