Other modifiers

Explore the other modifiers available in CQL.

Modifiers are natural language functions that convert one value to another. Typically, they are categorized by the data type they operate on. However, some modifiers are not specific to a particular data type or category, as is the case with the modifiers in this section.

The following table summarizes these other modifiers for quick reference:

CastConverts a value from one type to another.


This modifier converts a value from one type to another. It is particularly useful when comparing values of different types, or when passing a value of one type to a function that requires a different type.

The cast modifier follows the same logic as any other conversion in CQL, meaning that explicitly casting a value to a number works just like an implicit conversion when passing a value to a function that requires a number. See conversions for more details.


This modifier has the following syntax:

/*<value>*/ as /*<type>*/
Try in Playground

The /*<mode>*/ is a literal word that specifies the target type and cannot be specified dynamically using expressions.

The following table lists the supported types:

booleanConverts the value to a boolean.
stringConverts the value to a string.
numberConverts the value to a number.
integerConverts the value to an integer.
decimalConverts the value to a decimal.
floatConverts the value to a float.
collectionConverts the value to a collection.
timeConverts the value to a local time.
dateConverts the value to a local date.
datetimeConverts the value to a zoned date-time.

Note that attempting to cast a type not listed above results in an error.


These are the supported parameters:


The value you want to convert.


Here is a basic example of how to convert a string to a date:

"2019-01-01" as date
Try in Playground

You can also perform sequential conversions by chaining multiple casts together:

"2019-01-01" as datetime as date
Try in Playground

In this last example, the string is first converted to a zone date-time, then to a local date. Note that a direct conversion to a date may produce a different result, since no time zone conversion is performed.