public class DateTime extends Object
TokenTypeConstant.DATE
TokenTypeConstant.TIME
ScalarValuedFunction
,
DeriveFields
Modifier and Type | Class and Description |
---|---|
static class |
DateTime.DateTimeValue
Definitions of date and time values that can be extracted from date and timestamp types.
|
static class |
DateTime.Granularity
The desired granularity of the output.
|
Modifier and Type | Method and Description |
---|---|
static ScalarValuedFunction |
addTime(ScalarValuedFunction time,
ScalarValuedFunction delta,
DateTime.Granularity granularity)
Adds a time period to the specified date/time value.
|
static ScalarValuedFunction |
addTime(ScalarValuedFunction time,
ScalarValuedFunction delta,
DateTime.Granularity granularity,
TimeZone tz)
Adds a time period to the specified date/time value.
|
static ScalarValuedFunction |
addTime(String timeField,
String deltaField,
DateTime.Granularity granularity)
Adds a time period to the specified date/time value.
|
static ScalarValuedFunction |
addTime(String timeField,
String deltaField,
DateTime.Granularity granularity,
TimeZone tz)
Adds a time period to the specified date/time value.
|
static ScalarValuedFunction |
currentDate()
Returns the current date in the time zone of the local machine.
|
static ScalarValuedFunction |
currentDate(TimeZone tz)
Returns the current date in the specified time zone.
|
static ScalarValuedFunction |
currentTime()
Returns the current time of day in the time zone of the local machine.
|
static ScalarValuedFunction |
currentTime(TimeZone tz)
Returns the current time of day in the specified time zone.
|
static ScalarValuedFunction |
currentTimestamp()
Returns the current time stamp in the time zone of the local machine.
|
static ScalarValuedFunction |
currentTimestamp(TimeZone tz)
Returns the current time stamp in the specified time zone.
|
static ScalarValuedFunction |
getTextValue(ScalarValuedFunction expr,
DateTime.DateTimeValue valueType)
Create a function that will extract the wanted date or time value as text
from the given function applied to a record flow.
|
static ScalarValuedFunction |
getTextValue(ScalarValuedFunction expr,
DateTime.DateTimeValue valueType,
TimeZone tz)
Create a function that will extract the wanted date or time value as text
from the given function applied to a record flow.
|
static ScalarValuedFunction |
getTextValue(String field,
DateTime.DateTimeValue valueType)
Create a function that will extract the wanted date or time value as text
from the named field contained in a record flow.
|
static ScalarValuedFunction |
getTextValue(String field,
DateTime.DateTimeValue valueType,
TimeZone tz)
Create a function that will extract the wanted date or time value as text
from the named field contained in a record flow.
|
static ScalarValuedFunction |
getValue(ScalarValuedFunction expr,
DateTime.DateTimeValue valueType)
Create a function that will extract the wanted date or time value
from the given function applied to a record flow.
|
static ScalarValuedFunction |
getValue(ScalarValuedFunction expr,
DateTime.DateTimeValue valueType,
TimeZone tz)
Create a function that will extract the wanted date or time value
from the given function applied to a record flow.
|
static ScalarValuedFunction |
getValue(String field,
DateTime.DateTimeValue valueType)
Create a function that will extract the wanted date or time value
from the named field contained in a record flow.
|
static ScalarValuedFunction |
getValue(String field,
DateTime.DateTimeValue valueType,
TimeZone tz)
Create a function that will extract the wanted date or time value
from the named field contained in a record flow.
|
static ScalarValuedFunction |
subtractTime(ScalarValuedFunction time,
ScalarValuedFunction delta,
DateTime.Granularity granularity)
Subtracts a time period from the specified date/time value.
|
static ScalarValuedFunction |
subtractTime(ScalarValuedFunction time,
ScalarValuedFunction delta,
DateTime.Granularity granularity,
TimeZone tz)
Subtracts a time period from the specified date/time value.
|
static ScalarValuedFunction |
subtractTime(String timeField,
String deltaField,
DateTime.Granularity granularity)
Subtracts a time period from the specified date/time value.
|
static ScalarValuedFunction |
subtractTime(String timeField,
String deltaField,
DateTime.Granularity granularity,
TimeZone tz)
Subtracts a time period from the specified date/time value.
|
static ScalarValuedFunction |
timeDiff(ScalarValuedFunction startValue,
ScalarValuedFunction endValue,
DateTime.Granularity granularity)
Builds an expression measuring the time interval
between two date/time expressions using a specified time unit.
|
static ScalarValuedFunction |
timeDiff(ScalarValuedFunction startValue,
ScalarValuedFunction endValue,
DateTime.Granularity granularity,
int scale)
Builds an expression measuring the time interval
between two date/time expressions using a specified time unit
and scale.
|
static ScalarValuedFunction |
timeDiff(String startField,
String endField)
Builds an expression measuring the time interval
between two date/time fields.
|
static ScalarValuedFunction |
timeDiff(String startField,
String endField,
DateTime.Granularity granularity)
Builds an expression measuring the time interval
between two date/time fields using a specified time unit.
|
static ScalarValuedFunction |
timeDiff(String startField,
String endField,
DateTime.Granularity granularity,
int scale)
Builds an expression measuring the time interval
between two date/time fields using a specified time unit
and scale.
|
static ScalarValuedFunction |
toMilliseconds(ScalarValuedFunction expr)
Converts the value of a date/time expression into the number of milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
|
static ScalarValuedFunction |
toMilliseconds(String fieldName)
Converts the value of a date/time field into the number of milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
|
static ScalarValuedFunction |
useDefaultTimeZone(ScalarValuedFunction time)
Adjusts a time stamp value to use the time zone of the local machine.
|
static ScalarValuedFunction |
useDefaultTimeZone(String timeField)
Adjusts a time stamp value to use the time zone of the local machine.
|
static ScalarValuedFunction |
useTimeZone(ScalarValuedFunction time,
TimeZone tz)
Adjusts a time stamp value to use the specified time zone.
|
static ScalarValuedFunction |
useTimeZone(String timeField,
TimeZone tz)
Adjusts a time stamp value to use the specified time zone.
|
public static ScalarValuedFunction getValue(String field, DateTime.DateTimeValue valueType)
field
- name of the field containing a date or time stamp valuevalueType
- date or time value to extractpublic static ScalarValuedFunction getValue(String field, DateTime.DateTimeValue valueType, TimeZone tz)
field
- name of the field containing a date, time of day, or time stamp valuevalueType
- date or time value to extracttz
- time zone in which to interpret time stamp values. If null
,
the time zone of the local machine will be used. If the field value is
a date or time of day, a time zone is not required, and will be ignored.public static ScalarValuedFunction getValue(ScalarValuedFunction expr, DateTime.DateTimeValue valueType)
expr
- a function that returns a date, time of day, or time stamp valuevalueType
- date or time value to extractpublic static ScalarValuedFunction getValue(ScalarValuedFunction expr, DateTime.DateTimeValue valueType, TimeZone tz)
expr
- a function that returns a date, time of day, or time stamp valuevalueType
- date or time value to extracttz
- time zone in which to interpret time stamp values. If null
,
the time zone of the local machine will be used. If the expression value is
a date or time of day, a time zone is not required, and will be ignored.public static ScalarValuedFunction getTextValue(String field, DateTime.DateTimeValue valueType)
field
- name of the field containing a date or time stamp valuevalueType
- date or time value to extractpublic static ScalarValuedFunction getTextValue(String field, DateTime.DateTimeValue valueType, TimeZone tz)
field
- name of the field containing a date, time of day, or time stamp valuevalueType
- date or time value to extracttz
- time zone in which to interpret time stamp values. If null
,
the time zone of the local machine will be used. If the field value is
a date or time of day, a time zone is not required, and will be ignored.public static ScalarValuedFunction getTextValue(ScalarValuedFunction expr, DateTime.DateTimeValue valueType)
expr
- a function that returns a date, time of day, or time stamp valuevalueType
- date or time value to extractpublic static ScalarValuedFunction getTextValue(ScalarValuedFunction expr, DateTime.DateTimeValue valueType, TimeZone tz)
expr
- a function that returns a date, time of day, or time stamp valuevalueType
- date or time value to extracttz
- time zone in which to interpret time stamp values. If null
,
the time zone of the local machine will be used. If the expression value is
a date or time of day, a time zone is not required, and will be ignored.public static ScalarValuedFunction timeDiff(String startField, String endField)
startField
- the field defining the start of the intervalendField
- the field defining the end of the intervalpublic static ScalarValuedFunction timeDiff(String startField, String endField, DateTime.Granularity granularity)
startField
- the field defining the start of the intervalendField
- the field defining the end of the intervalgranularity
- the time unit in which to measure the interval lengthpublic static ScalarValuedFunction timeDiff(String startField, String endField, DateTime.Granularity granularity, int scale)
startField
- the field defining the start of the intervalendField
- the field defining the end of the intervalgranularity
- the time unit in which to measure the interval lengthscale
- fractional scale of the differencepublic static ScalarValuedFunction timeDiff(ScalarValuedFunction startValue, ScalarValuedFunction endValue, DateTime.Granularity granularity)
startValue
- an expression defining the start of the intervalendValue
- an expression defining the end of the intervalgranularity
- the time unit in which to measure the interval lengthpublic static ScalarValuedFunction timeDiff(ScalarValuedFunction startValue, ScalarValuedFunction endValue, DateTime.Granularity granularity, int scale)
startValue
- an expression defining the start of the intervalendValue
- an expression defining the end of the intervalgranularity
- the time unit in which to measure the interval lengthscale
- fractional scale of the interval lengthpublic static ScalarValuedFunction toMilliseconds(String fieldName)
fieldName
- the field containing the value to convertpublic static ScalarValuedFunction toMilliseconds(ScalarValuedFunction expr)
expr
- the expression to convertpublic static ScalarValuedFunction currentDate()
public static ScalarValuedFunction currentDate(TimeZone tz)
tz
- the time zone from which to get the current date. If null
,
the time zone of the local machine will be used.public static ScalarValuedFunction currentTime()
public static ScalarValuedFunction currentTime(TimeZone tz)
tz
- the time zone from which to get the current time of day. If null
,
the time zone of the local machine will be used.public static ScalarValuedFunction currentTimestamp()
public static ScalarValuedFunction currentTimestamp(TimeZone tz)
tz
- the time zone from which to get the current time stamp. If null
,
the time zone of the local machine will be used.public static ScalarValuedFunction addTime(String timeField, String deltaField, DateTime.Granularity granularity)
Computation on time stamp values is performed relative to the time zone of the local machine. Date and time of day values are processed independent of time zone.
It is an error to add units smaller than a day to a date value. Similarly, it is an error to add units larger than an hour to a time of day value.
timeField
- the field containing the base valuedeltaField
- the field containing the length of the time period to add.granularity
- the units in which the time period is measuredpublic static ScalarValuedFunction addTime(String timeField, String deltaField, DateTime.Granularity granularity, TimeZone tz)
Computation on time stamp values is performed relative to the specified time zone. Date and time of day values are processed independent of time zone.
It is an error to add units smaller than a day to a date value. Similarly, it is an error to add units larger than an hour to a time of day value.
timeField
- the field containing the base valuedeltaField
- the field containing the length of the time period to add.granularity
- the units in which the time period is measuredtz
- the time zone in which to perform the computation. If null
,
the time zone of the local machine will be used.public static ScalarValuedFunction addTime(ScalarValuedFunction time, ScalarValuedFunction delta, DateTime.Granularity granularity)
Computation on time stamp values is performed relative to the time zone of the local machine. Date and time of day values are processed independent of time zone.
It is an error to add units smaller than a day to a date value. Similarly, it is an error to add units larger than an hour to a time of day value.
time
- the expression providing the base valuedelta
- the expression providing the length of the time period to add.granularity
- the units in which the time period is measuredpublic static ScalarValuedFunction addTime(ScalarValuedFunction time, ScalarValuedFunction delta, DateTime.Granularity granularity, TimeZone tz)
Computation on time stamp values is performed relative to the specified time zone. Date and time of day values are processed independent of time zone.
It is an error to add units smaller than a day to a date value. Similarly, it is an error to add units larger than an hour to a time of day value.
time
- the expression providing the base valuedelta
- the expression providing the length of the time period to add.granularity
- the units in which the time period is measuredtz
- the time zone in which to perform the computation. If null
,
the time zone of the local machine will be used.public static ScalarValuedFunction subtractTime(String timeField, String deltaField, DateTime.Granularity granularity)
Computation on time stamp values is performed relative to the time zone of the local machine. Date and time of day values are processed independent of time zone.
It is an error to subtract units smaller than a day from a date value. Similarly, it is an error to subtract units larger than an hour from a time of day value.
timeField
- the field containing the base valuedeltaField
- the field containing the length of the time period to add.granularity
- the units in which the time period is measuredgranularity
- the granularity of delta
public static ScalarValuedFunction subtractTime(String timeField, String deltaField, DateTime.Granularity granularity, TimeZone tz)
Computation on time stamp values is performed relative to the specified time zone. Date and time of day values are processed independent of time zone.
It is an error to subtract units smaller than a day from a date value. Similarly, it is an error to subtract units larger than an hour from a time of day value.
timeField
- the field containing the base valuedeltaField
- the field containing the length of the time period to add.granularity
- the units in which the time period is measuredtz
- the time zone to use for time stamp processing. If null
,
the time zone of the local machine will be used.public static ScalarValuedFunction subtractTime(ScalarValuedFunction time, ScalarValuedFunction delta, DateTime.Granularity granularity)
Computation on time stamp values is performed relative to the time zone of the local machine. Date and time of day values are processed independent of time zone.
It is an error to subtract units smaller than a day from a date value. Similarly, it is an error to subtract units larger than an hour from a time of day value.
time
- the expression providing the base valuedelta
- the expression providing the length of the time period to add.granularity
- the units in which the time period is measuredpublic static ScalarValuedFunction subtractTime(ScalarValuedFunction time, ScalarValuedFunction delta, DateTime.Granularity granularity, TimeZone tz)
Computation on time stamp values is performed relative to the specified time zone. Date and time of day values are processed independent of time zone.
It is an error to subtract units smaller than a day from a date value. Similarly, it is an error to subtract units larger than an hour from a time of day value.
time
- the expression providing the base valuedelta
- the expression providing the length of the time period to add.granularity
- the units in which the time period is measuredtz
- the time zone to use for time stamp processing. If null
,
the time zone of the local machine will be used.public static ScalarValuedFunction useDefaultTimeZone(String timeField)
timeField
- the input time stamp fieldpublic static ScalarValuedFunction useDefaultTimeZone(ScalarValuedFunction time)
time
- the input time stamppublic static ScalarValuedFunction useTimeZone(String timeField, TimeZone tz)
time
- the input time stamp fieldtz
- the time zone of the result. If null
the time zone of the
local machine will be used.public static ScalarValuedFunction useTimeZone(ScalarValuedFunction time, TimeZone tz)
time
- the input time stamptz
- the time zone of the result. If null
the time zone of the
local machine will be used.Copyright © 2019 Actian Corporation. All rights reserved.