Package org.apache.derby.iapi.types
Interface DateTimeDataValue
- All Superinterfaces:
DataValueDescriptor
,Externalizable
,Formatable
,Orderable
,Serializable
,Storable
,TypedFormat
- All Known Implementing Classes:
SQLDate
,SQLTime
,SQLTimestamp
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Fields inherited from interface org.apache.derby.iapi.types.DataValueDescriptor
UNKNOWN_LOGICAL_LENGTH
Fields inherited from interface org.apache.derby.iapi.types.Orderable
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN
-
Method Summary
Modifier and TypeMethodDescriptiongetDate
(NumberDataValue result) Get the day of the month.getHours
(NumberDataValue result) Get the hour of the day out of a time or timestamp.getMinutes
(NumberDataValue result) Get the minute of the hour out of a time or timestamp.getMonth
(NumberDataValue result) Get the month number out of a date.getSeconds
(NumberDataValue result) Get the second of the minute out of a time or timestamp.getYear
(NumberDataValue result) Get the year number out of a date.timestampAdd
(int intervalType, NumberDataValue intervalCount, Date currentDate, DateTimeDataValue resultHolder) Add a number of intervals to a datetime value.timestampDiff
(int intervalType, DateTimeDataValue time1, Date currentDate, NumberDataValue resultHolder) Finds the difference between two datetime values as a number of intervals.Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor
checkHostVariable, cloneHolder, cloneValue, coalesce, compare, compare, compare, compare, equals, estimateMemoryUsage, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLength, getLong, getNewNull, getObject, getShort, getStream, getString, getTime, getTimestamp, getTraceString, getTypeName, greaterOrEquals, greaterThan, hasStream, in, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, readExternalFromArray, recycle, setBigDecimal, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueFromResultSet, typePrecedence, typeToBigDecimal
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
Methods inherited from interface org.apache.derby.iapi.services.io.Storable
isNull, restoreToNull
Methods inherited from interface org.apache.derby.iapi.services.io.TypedFormat
getTypeFormatId
-
Field Details
-
YEAR_FIELD
static final int YEAR_FIELD- See Also:
-
MONTH_FIELD
static final int MONTH_FIELD- See Also:
-
DAY_FIELD
static final int DAY_FIELD- See Also:
-
HOUR_FIELD
static final int HOUR_FIELD- See Also:
-
MINUTE_FIELD
static final int MINUTE_FIELD- See Also:
-
SECOND_FIELD
static final int SECOND_FIELD- See Also:
-
FRAC_SECOND_INTERVAL
static final int FRAC_SECOND_INTERVAL- See Also:
-
SECOND_INTERVAL
static final int SECOND_INTERVAL- See Also:
-
MINUTE_INTERVAL
static final int MINUTE_INTERVAL- See Also:
-
HOUR_INTERVAL
static final int HOUR_INTERVAL- See Also:
-
DAY_INTERVAL
static final int DAY_INTERVAL- See Also:
-
WEEK_INTERVAL
static final int WEEK_INTERVAL- See Also:
-
MONTH_INTERVAL
static final int MONTH_INTERVAL- See Also:
-
QUARTER_INTERVAL
static final int QUARTER_INTERVAL- See Also:
-
YEAR_INTERVAL
static final int YEAR_INTERVAL- See Also:
-
-
Method Details
-
getYear
Get the year number out of a date.- Parameters:
result
- The result of the previous call to this method, null if not called yet.- Returns:
- A NumberDataValue containing the year number.
- Throws:
StandardException
- Thrown on error
-
getMonth
Get the month number out of a date.- Parameters:
result
- The result of the previous call to this method, null if not called yet.- Returns:
- A NumberDataValue containing the month number.
- Throws:
StandardException
- Thrown on error
-
getDate
Get the day of the month.- Parameters:
result
- The result of the previous call to this method, null if not called yet.- Returns:
- A NumberDataValue containing the day of the month.
- Throws:
StandardException
- Thrown on error
-
getHours
Get the hour of the day out of a time or timestamp.- Parameters:
result
- The result of the previous call to this method, null if not called yet.- Returns:
- A NumberDataValue containing the hour of the day.
- Throws:
StandardException
- Thrown on error
-
getMinutes
Get the minute of the hour out of a time or timestamp.- Parameters:
result
- The result of the previous call to this method, null if not called yet.- Returns:
- A NumberDataValue containing the minute of the hour.
- Throws:
StandardException
- Thrown on error
-
getSeconds
Get the second of the minute out of a time or timestamp.- Parameters:
result
- The result of the previous call to this method, null if not called yet.- Returns:
- A NumberDataValue containing the second of the minute.
- Throws:
StandardException
- Thrown on error
-
timestampAdd
DateTimeDataValue timestampAdd(int intervalType, NumberDataValue intervalCount, Date currentDate, DateTimeDataValue resultHolder) throws StandardException Add a number of intervals to a datetime value. Implements the JDBC escape TIMESTAMPADD function.- Parameters:
intervalType
- One of FRAC_SECOND_INTERVAL, SECOND_INTERVAL, MINUTE_INTERVAL, HOUR_INTERVAL, DAY_INTERVAL, WEEK_INTERVAL, MONTH_INTERVAL, QUARTER_INTERVAL, or YEAR_INTERVALintervalCount
- The number of intervals to addcurrentDate
- Used to convert time to timestampresultHolder
- If non-null a DateTimeDataValue that can be used to hold the result. If null then generate a new holder- Returns:
- startTime + intervalCount intervals, as a timestamp
- Throws:
StandardException
-
timestampDiff
NumberDataValue timestampDiff(int intervalType, DateTimeDataValue time1, Date currentDate, NumberDataValue resultHolder) throws StandardException Finds the difference between two datetime values as a number of intervals. Implements the JDBC TIMESTAMPDIFF escape function.- Parameters:
intervalType
- One of FRAC_SECOND_INTERVAL, SECOND_INTERVAL, MINUTE_INTERVAL, HOUR_INTERVAL, DAY_INTERVAL, WEEK_INTERVAL, MONTH_INTERVAL, QUARTER_INTERVAL, or YEAR_INTERVALtime1
-currentDate
- Used to convert time to timestampresultHolder
- If non-null a DateTimeDataValue that can be used to hold the result. If null then generate a new holder- Returns:
- the number of intervals by which this datetime is greater than time1
- Throws:
StandardException
-