Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jet.connect
Class DbDateTime

    java.lang.Object
      jet.connect.DbValue
          jet.connect.DbDateTime

All Implemented Interfaces:
  jet.util.DbValueable, jet.util.QuickSortableNode

Direct Known Subclasses:
  DbDate, DbTime, DbTimestamp

    public abstract class DbDateTime

extends DbValue

The super class of DbDate, DbTime, and DbTimestamp.

A thin wrapper around a millisecond value allows JDBC to identify it as an SQL `DATE` value. A milliseconds value represents the number of that milliseconds that have passed since January 1, 1970 00:00:00.000 GMT. Note that this class should not be initialized directly.

Field Summary
`long` | `value` Deprecated.

Fields inherited from class jet.connect.DbValue
`bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC`

Fields inherited from interface jet.util.DbValueable
`EQUAL, GREATER, LESS`

Constructor Summary
`DbDateTime()` Constructs an uninitialized `DbDateTime`.
`DbDateTime(DbColDesc desc)` Constructs an uninitialized `DbDateTime`.

Method Summary
`int` | `compareTo(DbValue v)` Compares this `DbDateTime` object with the DbValue object.
`boolean` | `equals(DbValue v)` Compares this object to the specified object.
`long` | `get()` Returns the value of this `DbDateTime` as a `long` value.
`void` | `set(DbValue v)` Sets a newly allocated `DbDateTime` object that represents the `long` value indicated by the `DbValue` parameter.
`void` | `set(long v)` Sets a newly allocated `DbDateTime` object that represents the specified `long` argument.
`java.lang.String` | `toFormatString(java.lang.String pattern)` Uses `java.text.SimpleDateFormat` for formatting dates in a locale-sensitive manner.
`java.util.Date` | `toSqlDate()` Returns a `java.sql.Date` object using the milliseconds time value.
`java.lang.String` | `toStringValue()`
`java.util.Date` | `toUtilDate()` Returns a `java.util.Date` object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.

Methods inherited from class jet.connect.DbValue
`clone, compareTo, compareTo, equals, getColDesc, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, set, set, setColDesc, setfoo, setNull, setValue, setValue, toString`

Methods inherited from class java.lang.Object
`getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### value

    public long value

  Deprecated.
  The field contains the value of this object. Note use `get` and `set` to access it instead of accessing it directly.

Constructor Detail

### DbDateTime

    public DbDateTime()

  Constructs an uninitialized `DbDateTime`. This DbDateTime object is mutable until the value and the description of the column are set.

### DbDateTime

    public DbDateTime(DbColDesc desc)

  Constructs an uninitialized `DbDateTime`. This `DbDateTime` object is mutable until the value is set.

  Parameters:
    `desc` - The value to be represented by the `DbColDesc` object.

Method Detail

### get

    public long get()

  Returns the value of this `DbDateTime` as a `long` value.

  Returns:
    the value that is a milliseconds value representing the number of milliseconds that has passed since January 1, 1970 00:00:00.000 GMT.

### set

    public void set(long v)

  Sets a newly allocated `DbDateTime` object that represents the specified `long` argument.

  Parameters:
    `v` - Milliseconds since January 1, 1970, 00:00:00 GMT, not exceeding the milliseconds representation for the year 8099. A negative number indicates the number of milliseconds before January 1, 1970, 00:00:00 GMT.

### toUtilDate

    public java.util.Date toUtilDate()

  Returns a `java.util.Date` object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT.

### toSqlDate

    public java.util.Date toSqlDate()

  Returns a `java.sql.Date` object using the milliseconds time value. If the milliseconds value contains time information, this method will return the time component to the time in the default time zone (the time zone of the Java virtual machine running the application) that corresponds to zero GMT.

### toFormatString

    public java.lang.String toFormatString(java.lang.String pattern)

  Uses `java.text.SimpleDateFormat` for formatting dates in a locale-sensitive manner.

  Parameters:
    `pattern` - The string is defined in java.text.SimpleDateFormat.

    #### Examples

    The following examples show how date and time patterns are interpreted in the U.S. locale. The given date and time are 2001-07-04 12:08:56, which is the local time in the U.S. Pacific Time time zone.

    > Date and Time Pattern | Result
    > --- | ---
    > `"yyyy.MM.dd G 'at' HH:mm:ss z"` | `2001.07.04 AD at 12:08:56 PDT`
    > `"EEE, MMM d, ''yy"` | `Wed, Jul 4, '01`
    > `"h:mm a"` | `12:08 PM`
    > `"hh 'o''clock' a, zzzz"` | `12 o'clock PM, Pacific Daylight Time`
    > `"K:mm a, z"` | `0:08 PM, PDT`
    > `"yyyyy.MMMMM.dd GGG hh:mm aaa"` | `02001.July.04 AD 12:08 PM`
    > `"EEE, d MMM yyyy HH:mm:ss Z"` | `Wed, 4 Jul 2001 12:08:56 -0700`
    > `"yyMMddHHmmssZ"` | `010704120856-0700`
    > `"yyyy-MM-dd'T'HH:mm:ss.SSSZ"` | `2001-07-04T12:08:56.235-0700`
    > `"yyyy-MM-dd'T'HH:mm:ss.SSSXXX"` | `2001-07-04T12:08:56.235-07:00`
    > `"YYYY-'W'ww-u"` | `2001-W27-3`

  Returns:
    the String that formated according to the pattern
  See Also:
    `SimpleDateFormat`

### equals

    public boolean equals(DbValue v)

  Compares this object to the specified object. The result is `true` if and only if the argument is not `null` but a `DbDateTime` object that contains the same `long` value as this object.

  Specified by:
    `equals` in class `DbValue`
  Parameters:
    `v` - The DbValue object to be compared with.
  Returns:
    `true` if the objects are the same; `false` otherwise.

### compareTo

    public int compareTo(DbValue v)

  Compares this `DbDateTime` object with the DbValue object.

  Specified by:
    `compareTo` in class `DbValue`
  Returns:
    LESS, EQUAL, or GREAT.
  See Also:
    `DbValueable`

### set

    public void set(DbValue v)

  Sets a newly allocated `DbDateTime` object that represents the `long` value indicated by the `DbValue` parameter. The DbValue object will be checked to see if it is null.

  Specified by:
    `set` in class `DbValue`
  Parameters:
    `v` - The `DbValue` to be converted to a `DbChar`. If it is null, the value will not be set.

### toStringValue

    public java.lang.String toStringValue()

  Specified by:
    `toStringValue` in class `DbValue`
  Returns:
    a string which will represent the value in the DbValue(null flag and value). When compare StringValue from DbValues, we always assume that: the two DbValues have same DbColDesc. Two StringValue equals means the original DbValue equals. Does NOT transfer the compareTo(DbValue v) method. Only comparable dbValue implements this methods. String coding uses Base64.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD