Type Conversion

NameDescriptionExample
boolean

Converts the argument to boolean

boolean("") == False
number

Converts the argument to number

number("456") == 456
string

Converts the argument to string

string(123) == "123"
timestamp

Converts the argument to timestamp

timestamp("2015-06-25T11:08:44Z") == timestamp(1435230524)

Boolean conversion function is used for getting the truth value of any expression.

boolean(value_to_be_converted)
ArgumentTypeMeaning
value_to_be_converted

any type

Value to be converted into a boolean

All the following expressions result in true:

boolean("Recombee") == true

boolean("") == False

boolean(42) == true

boolean(0) == False

boolean({""}) == true

boolean({}) == False

Number conversion function is used for converting strings, booleans and timestamps into numbers.

number(value_to_be_converted)
ArgumentTypeMeaning
value_to_be_converted

string boolean timestamp number

Value to be converted into a number

All the following expressions result in true:

number("456") == 456

number("1E4") == 10000

number(true) == 1

// String "Recombee" cannot be converted into a number
number("Recombee") == null

String conversion function is used for converting numbers, booleans, sets and timestamps into their textual representations.

string(value_to_be_converted [, date_time_format (only if value_to_be_converted is a timestamp)])
ArgumentTypeMeaning
value_to_be_converted

string boolean timestamp set number

Value to be converted into a string

date_time_format

string

(Optional and only if value_to_be_converted is a timestamp) String specifying the format of textual representation of the timestamp after conversion. See supported date and time format specifiers. If date_time_format is not specified, ISO 8601 format is used.

All the following expressions result in true:

string(123) == "123"

string(true) == "true"

// Suppose that 'time' is a timestamp with value 1435230524. No format string is specified, so ISO 8601 is used.
string('time') == "2015-06-25T11:08:44Z"

// Suppose that 'time' is a timestamp with value 1435230524.
string('time', "%d.%m.%Y %H:%M:%S") == "25.06.2015 11:08:44"

Timestamp conversion function is used for converting numbers and strings into timestamps.

timestamp(value_to_be_converted [, date_time_format (only if value_to_be_converted is a string) ] )
ArgumentTypeMeaning
value_to_be_converted

string number timestamp

Value to be converted into a string

date_time_format

string

(Optional and only if value_to_be_converted is a string) String specifying the format of value_to_be_converted. See supported date and time format specifiers. If date_time_format is not specified, ISO 8601 format is used.

All the following expressions result in true:

// No format string is specified, so ISO 8601 is used.
timestamp("2015-06-25T11:08:44Z") == timestamp(1435230524)

timestamp("25.06.2015 11:08:44", "%d.%m.%Y %H:%M:%S") == timestamp(1435230524)
© Copyright 2026, Recombee s.r.o
docs.recombee.com