public class ConversionFunctions extends AbstractFunctionHandler
Modifier and Type | Field and Description |
---|---|
static String |
DAY
Represents the
Calendar.DATE field, is: d. |
static String |
DEFAULT_DATE_FORMAT_SPEC |
static String |
DEFAULT_DATE_FORMAT_SPEC_2 |
static String |
DEFAULT_DATE_FORMAT_SPEC_3 |
static String |
HANDLER_ID |
static String |
HOUR
Represents the
Calendar.HOUR_OF_DAY field, is: h. |
static String |
MINUTE
Represents the
Calendar.MINUTE field, is: mi. |
static String |
MONTH
Represents the
Calendar.MONTH field, is: m. |
static String |
SECOND
Represents the
Calendar.SECOND field, is: s. |
static String |
WEEK
Represents the
Calendar.WEEK_OF_YEAR field, is: w. |
static String |
YEAR
Represents the
Calendar.YEAR field, is: y. |
q
Constructor and Description |
---|
ConversionFunctions() |
Modifier and Type | Method and Description |
---|---|
Date |
addTime(Date d,
Double amount,
String type) |
String |
lower(Object o) |
int |
timeField(Object d,
String type)
This method (function) will return the associated field from a
Calendar instance. |
Date |
to_date(Object value) |
Date |
to_date(String value,
String spec) |
Number |
to_number(Object o) |
String |
to_string(Object o) |
Date |
toDate(Object value) |
Date |
toDate(String value,
String spec) |
Long |
toDateMillis(String value,
String spec) |
Long |
toMillis(Date d) |
Number |
toNumber(Object o) |
String |
toString(Object o) |
String |
upper(Object o) |
setQuery
public static final String HANDLER_ID
public static final String MINUTE
Calendar.MINUTE
field, is: mi.public static final String DAY
Calendar.DATE
field, is: d.public static final String YEAR
Calendar.YEAR
field, is: y.public static final String SECOND
Calendar.SECOND
field, is: s.public static final String HOUR
Calendar.HOUR_OF_DAY
field, is: h.public static final String MONTH
Calendar.MONTH
field, is: m.public static final String WEEK
Calendar.WEEK_OF_YEAR
field, is: w.public static String DEFAULT_DATE_FORMAT_SPEC
public static String DEFAULT_DATE_FORMAT_SPEC_2
public static String DEFAULT_DATE_FORMAT_SPEC_3
public int timeField(Object d, String type) throws QueryExecutionException
Calendar
instance. The type parm should be one of the
constants from this class. The default TimeZone
is used.d
- If the type is a long value then it is first converted to a Date.
Or a Date
should be used.type
- The type of field to get.Calendar
.QueryExecutionException
- If the d parm isn't an instance of
Long
or Date
.public Date toDate(Object value) throws QueryExecutionException
QueryExecutionException
public Date to_date(Object value) throws QueryExecutionException
QueryExecutionException
public Date to_date(String value, String spec) throws QueryExecutionException
QueryExecutionException
public Date toDate(String value, String spec) throws QueryExecutionException
QueryExecutionException
public Long toDateMillis(String value, String spec) throws QueryExecutionException
QueryExecutionException