Available Functions : Using Core Functions : Conversion Functions
 
Share this page                  
Conversion Functions
The Conversions category provides a set of functions for converting the types of input data values.
Function Name
Description
Output Type
Parameters
Conversions.asBoolean
Convert an int typed field into a boolean type.
boolean
int value to convert
int representing true
int representing false
Conversions.asDate
Convert a timestamp typed field into a date field. This down casting essentially drops the time portion of the timestamp field, leaving only the date portion.
date
Timestamp value to convert
Conversions.asDouble
Convert a numeric typed field into a double type. Note that precision may be lost during the conversion if conversion is from a wider type.
double
Numeric value to convert
Conversions.asFloat
Convert a numeric typed field into a float type. Note that precision may be lost during the conversion if conversion is from a wider type.
float
Numeric value to convert
Conversions.asInt
Convert a numeric typed field into an int type. Note that precision may be lost during the conversion.
int
Numeric value to convert
Conversions.asLong
Convert a numeric typed field into a long type. Note that precision may be lost during the conversion if conversion is from a wider type.
long
Numeric value to convert
Conversions.asNumeric
Convert a numeric typed field into a Numeric type.
Numeric
Numeric value to convert
Conversions.asTime
Convert a timestamp typed field into a time field. This down casting essentially drops the date portion of the timestamp field, leaving only the time portion.
date
Timestamp value to convert
Conversions.toBinary
Convert a string typed field into a binary type.
binary
String value to convert
Conversions.toBoolean
Convert a string typed field into a boolean type.
boolean
String value to convert
String representing true
String representing false
Conversions.toChar
Converts a string typed field into a char type. If the length of the string is greater than one, only the first character is used.
char
String value to convert
Conversions.toDate
Converts a string typed field into a date type. May optionally specify a custom DateFormat string for parser. If none is provided, the default ISO 8601 format is used (for example, 2012-01-27).
Date
String value to convert
Optional format string
Conversions.toDouble
Converts a string typed field into a double type. May optionally specify a NumberFormat string for parsing. If none is provided, the default format for the default locale is used.
double
String value to convert
Optional format string
Conversions.toFloat
Converts a string typed field into a float type. May optionally specify a NumberFormat string for parsing. If none is provided, the default format for the default locale is used.
float
String value to convert
Optional format string
Conversions.toInt
Converts a string typed field into a float type. May optionally specify a NumberFormat string for parsing. If none is provided, the default format for the default locale is used.
int
String value to convert
Optional format string
Conversions.toLong
Converts a string typed field into a long type. May optionally specify a NumberFormat string for parsing. If none is provided, the default format for the default locale is used.
long
String value to convert
Optional format string
Conversions.toNumeric
Converts a string typed field into a numeric type. May optionally specify a NumberFormat string for parsing. If none is provided, the default format for the default locale is used.
Numeric
String value to convert
Optional format string
Conversions.toString
Convert a scalar type field into a string value. The default formatting per data type will be used.
String
Any scalar type value
Conversions.toText
Convert the value of an expression into text using the given format.
String
Input value
Format or a pattern to apply
Conversions.toTime
Converts a string typed field into a time type. May optionally specify a custom DateFormat string for parsing. If none is provided, the default ISO 8601 format is used (for example, 13:45:26.000).
Time
String value to convert
Optional format string
Conversions.toTimestamp
Converts a string typed field into a timestamp type. May optionally specify a custom DateFormat string for parsing. If none is provided, the default ISO 8601 format is used (for example, 2012-01-27T13:45:26.000-0500).
Timestamp
String value to convert
Optional format string