@Deprecated public class DateTokenConverter extends Object implements DateValued
DateToken
.
Utilities for many of the same conversions are also available
in DateDataUtil
. However, if many conversions
are to be performed, it is more efficient to reuse
a DateTokenConverter
.
Constructor and Description |
---|
DateTokenConverter()
Deprecated.
Constructs a new converter.
|
DateTokenConverter(long epochDays)
Deprecated.
Constructs a converter initialized with
the specified date.
|
Modifier and Type | Method and Description |
---|---|
CalendarDate |
asCalendarDate()
Deprecated.
Gets the contained date value.
|
Date |
asDate()
Deprecated.
Gets the contained date value as a
java.sql.Date
relative to the default time zone. |
Date |
asDate(TimeZone tz)
Deprecated.
Gets the contained date value as a
java.sql.Date
relative to the given time zone. |
long |
asEpochDays()
Deprecated.
Gets the contained date value as the number of days since
Java epoch (January 1, 1970).
|
String |
asString()
Deprecated.
Gets a string representation of the current date value.
|
ScalarTokenType |
getType()
Deprecated.
Gets the data type of the token.
|
boolean |
isNull()
Deprecated.
Indicates whether the token is null valued.
|
boolean |
isZero()
Deprecated.
Indicates whether the value is the zero value
for the type.
|
void |
set(Date date,
TimeZone tz)
Deprecated.
Sets the current date value to the date portion
of the specified Java date in the given time zone.
|
void |
set(String timestamp)
Deprecated.
Sets the current date value to the date portion
of the specified timestamp.
|
void |
set(TimestampValued token)
Deprecated.
Sets the current date value to the date portion of
the specified timestamp value.
|
void |
setEpochDays(long epochDays)
Deprecated.
Sets the current date value to the specified date.
|
public DateTokenConverter()
public DateTokenConverter(long epochDays)
epochDays
- the date specified in epoch
days.public ScalarTokenType getType()
TokenValued
getType
in interface ScalarValued
getType
in interface TokenValued
getType
in interface ScalarTyped
getType
in interface TokenTyped
public boolean isNull()
TokenValued
isNull
in interface TokenValued
true
if the token is null valued,
false
otherwisepublic long asEpochDays()
DateValued
asEpochDays
in interface DateValued
TokenValued.isNull()
,
0
is returned.public final boolean isZero()
ScalarValued
isZero
in interface ScalarValued
true
if the value is the zero value,
false
otherwise.public void setEpochDays(long epochDays)
epochDays
- the date specified in epoch
days.public Date asDate()
DateValued
java.sql.Date
relative to the default time zone. The time zone used by
TimeZone.getDefault()
is used.asDate
in interface DateValued
java.sql.Date
.
If null valued, as indicated by TokenValued.isNull()
,
null
is returned.public Date asDate(TimeZone tz)
DateValued
java.sql.Date
relative to the given time zone.asDate
in interface DateValued
tz
- the time zone in which to interpret the datejava.sql.Date
.
If null valued, as indicated by TokenValued.isNull()
,
null
is returned.public CalendarDate asCalendarDate()
DateValued
asCalendarDate
in interface DateValued
TokenValued.isNull()
,
null
is returned.public void set(TimestampValued token)
token
- the timestamp value to truncatepublic void set(Date date, TimeZone tz)
date
- the timestamp valuetz
- the time zone to which the timestamp is relativepublic String asString()
public void set(String timestamp)
For repeated parsing of strings, reuse of a
DateTokenConverter
is more efficient
than DateDataUtil.parse(String)
.
timestamp
- an ISO 8601 timestamp valueCopyright © 2016 Actian Corporation. All rights reserved.