public abstract class DbDateTime extends DbValue
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.
Modifier and Type | Field and Description |
---|---|
static int |
Unknown_DataTimeZone
The default value of base time zone offset to GMT in milli-seconds during read data value.
|
long |
value
Deprecated.
|
BIGINT_DESC, bNull, CHAR_DESC, CURRENCY_DESC, DATE_DESC, desc, DOUBLE_DESC, INTEGER_DESC, TIME_DESC
Constructor and Description |
---|
DbDateTime()
Constructs an uninitialized
DbDateTime . |
DbDateTime(DbColDesc desc)
Constructs an uninitialized
DbDateTime . |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DbValue v,
boolean matchSQL)
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. |
int |
getDataTimeZone()
Set The base time zone offset to GMT in milli-seconds during read data value.
|
long |
getFullValue()
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. |
void |
setDataTimeZone(int offset)
Set The base time zone offset to GMT in milli-seconds during read data value.
|
void |
setFullValue(long v)
When v is accurate long value with Milliseconds and sql type is Db.SQL_TIMESTAMP, according to Libin,
not correct by using method of set(long v), so need rewrite this method in class of DbTimestamp
|
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. |
clone, compareTo, compareTo, compareTo, equals, getColDesc, getPrecision, getScale, getSqlType, isCurrency, isNull, makeDbValue, set, set, setColDesc, setfoo, setNull, setValue, setValue, toString
public long value
get
and set
to access it instead of accessing it directly.public static int Unknown_DataTimeZone
public DbDateTime()
DbDateTime
. This
DbDateTime object is mutable until the value and the description of the column are set.public DbDateTime(DbColDesc desc)
DbDateTime
. This
DbDateTime
object is mutable until the value is set.desc
- The value to be represented by the
DbColDesc
object.public long get()
DbDateTime
as a
long
value.public long getFullValue()
DbDateTime
as a
long
value.public void set(long v)
DbDateTime
object that
represents the specified long
argument.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.public void setFullValue(long v)
v
- public java.util.Date toUtilDate()
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.public java.util.Date toSqlDate()
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.public java.lang.String toFormatString(java.lang.String pattern)
java.text.SimpleDateFormat
for formatting
dates in a locale-sensitive manner.pattern
- The string is defined in java.text.SimpleDateFormat.
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
SimpleDateFormat
public boolean equals(DbValue v)
true
if and only if the argument is not
null
but a DbDateTime
object that
contains the same long
value as this object.public int compareTo(DbValue v, boolean matchSQL)
DbDateTime
object with the DbValue object.public void set(DbValue v)
DbDateTime
object that
represents the long
value indicated by the
DbValue
parameter. The DbValue object will be checked to see if it is null.public java.lang.String toStringValue()
toStringValue
in class DbValue
public void setDataTimeZone(int offset)
public int getDataTimeZone()
getDataTimeZone
in class DbValue