Data types data-types
Technically, a constant always contains a data type. In the literal expression, we only specify the value. The data type can be inferred from the value (for example string, integer, decimal, etc.). For specific cases such as date time, we use dedicated functions for the representation.
The sections below provide information on the different data type expressions and how they are represented.
string string
Description
Common sequence of characters. It doesn’t have any specific size except the implicit one that comes from the environment such as the amount of memory available.
JSON format: String
Serialization format: UTF-8
Literal representation
"<value>"
'<value>'
Example
"hello world"
'hello world'
integer integer
Description
Integer value from -2^63 to 2^63-1.
JSON format: Number
Literal representation
<integer value>
Example
42
decimal decimal
Description
Decimal number. It represents a floating value:
- largest positive finite value of type double, (2-2-52)x21023
- smallest positive normal value of type double, 2-1022
- smallest positive nonzero value of type double, 2 p-1074
JSON format: Number
Serialization format: using ‘.’ as the decimal separator.
Literal representation
<integer value>.<integer value>
Example
3.14
boolean boolean
Description
Boolean value written lowercase: true or false
JSON format: Boolean
Literal representation
true
false
Example
true
dateOnly date-only
Description
Represents a date only without a time zone, viewed as a year-month-day.
It is a description of the date, as used for birthdays.
JSON format: String.
Format is: YYYY-MM-DD (ISO-8601), for example: “2021-03-11”.
It can be encapsulated in a toDateOnly function.
It uses DateTimeFormatter ISO_LOCAL_DATE_TIME to deserialize and serialize the value. Learn more
Literal representation
date("<dateOnly in ISO-8601 format>")
Example
date("2021-02-19")
dateTimeOnly date-time-only
Description
Represents a date time without a time zone, viewed as year-month-day-hour-minute-second-millisecond.
JSON format: String.
It does not store or represent a time zone. Instead, it is a description of the date, as used for birthdays, combined with the local time as seen on a wall clock.
It cannot represent an instant on the time-line without additional information such as an offset or time zone.
It can be encapsulated in a toDateTimeOnly function.
Serialization format: ISO-8601 extended offset date-time format.
It uses DateTimeFormatter ISO_LOCAL_DATE_TIME to deserialize and serialize the value. Learn more{_blank}.
Literal representation
date("<dateTimeOnly in ISO-8601 format>")
Examples
date("2024-02-19T00.00.000")
date("2024-02-19T00.00")
dateTime date-time
Description
Date time constant that also considers time zone. It represents a date-time with an offset from UTC.
It can be viewed as an instant in time with the additional information of the offset. It is a way to represent a specific “moment” at a certain place of the world.
JSON format: String.
It can be encapsulated in a toDateTime function.
Serialization format: ISO-8601 extended offset date-time format.
It uses DateTimeFormatter ISO_OFFSET_DATE_TIME to deserialize and serialize the value. Learn more{_blank}.
You can also pass an integer passing an epoch value. Read more{_blank}.
Time zone can be specified by an offset or a time zone code (example: Europe/Paris, Z - meaning UTC).
Literal representation
toDateTime("<dateTime in ISO-8601 format>")
date("<dateTime in ISO-8601 format>")
toDateTime(<integer value of an epoch in milliseconds>)
Examples
date("2024-02-19T00.00.000Z")
toDateTime("1977-04-22T06:00:00Z")
toDateTime("2023-12-03T15:15:30Z")
toDateTime("2023-12-03T15:15:30.123Z")
toDateTime("2023-12-03T15:15:30.123+02:00")
toDateTime("2023-12-03T15:15:30.123-00:20")
toDateTime(1560762190189)
duration duration
Description
It represents a time-based amount of time, such as ‘34.5 seconds’. It models a quantity or amount of time in terms of milliseconds.
The supported temporal units are: milliseconds, seconds, minutes, hours, days where a day equals to 24 hours. Years and months are not supported since they’re not a fixed amount of time.
JSON format: String.
It must be encapsulated in a toDuration function.
Serialization format: To deserialize a time zone ID, it uses the java function java.time.
Duration.parse: the formats accepted are based on the ISO-8601 duration format PnDTnHnMn.nS with days considered to be exactly 24 hours. Learn more{_blank}.
Literal representation
toDuration("<duration in ISO-8601 format>")
toDuration(<duration in milliseconds>)
Example
toDuration("PT5S") -- parses as 5 seconds
toDuration(500) -- parses as 500ms
toDuration("PT20.345S") -- parses as "20.345 seconds"
toDuration("PT15M") -- parses as "15 minutes" (where a minute is 60 seconds)
toDuration("PT10H") -- parses as "10 hours" (where an hour is 3600 seconds)
toDuration("P2D") -- parses as "2 days" (where a day is 24 hours or 86400 seconds)
toDuration("P2DT3H4M") -- parses as "2 days, 3 hours and 4 minutes"
toDuration("P-6H3M") -- parses as "-6 hours and +3 minutes"
toDuration("-P6H3M") -- parses as "-6 hours and -3 minutes"
toDuration("-P-6H+3M") -- parses as "+6 hours and -3 minutes"
list list
Description
Comma separated list of expressions using square brackets as delimiters.
Polymorphism is not supported, hence all the expressions contained in the list should have the same type.
Literal representation
[<expression>, <expression>, ... ]
Example
["value1","value2"]
[3,5]
[toDuration(500),toDuration(800)]
This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.
For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.
- TL;DR: This page describes every data type supported in the Journey advanced expression editor — string, integer, decimal, boolean, dateOnly, dateTimeOnly, dateTime, duration, and list — with their JSON formats, serialization rules, and literal representation syntax.
Intents:
- Identify the correct literal syntax for each data type when writing journey expressions
- Understand the difference between
dateOnly,dateTimeOnly, anddateTimetypes and when to use each - Represent a duration value using ISO-8601 format or milliseconds with the
toDuration()function - Construct a list expression with square bracket syntax for use in collection operations
- Use conversion functions (
toDateTime,toDateTimeOnly,toDuration,toDateOnly) to create typed constants
Glossary:
- dateOnly: A date without time or time zone, formatted as YYYY-MM-DD; suitable for birthdays or calendar dates (product-specific)
- dateTimeOnly: A date and time without time zone information; cannot represent a specific instant without an offset (product-specific)
- dateTime: A date-time constant that includes a UTC offset, representing a specific instant; can also be created from an epoch integer (product-specific)
- duration: A time-based amount modelled in milliseconds; uses ISO-8601
PnDTnHnMn.nSformat; years and months are not supported (product-specific) - list: A comma-separated collection of expressions of the same type, delimited by square brackets (product-specific)
Guardrails:
- Duration supports milliseconds, seconds, minutes, hours, and days only — years and months are not supported as they are not fixed amounts of time
- A
durationvalue must be wrapped intoDuration()— it cannot be expressed as a bare literal - All expressions in a
listmust have the same type — polymorphism is not supported dateTimeOnlycannot represent an instant in time without an additional offset or time zone
Terminology:
- Canonical name: Data Types — Acronym: none — variants: expression data types, journey data types
- Synonyms: “dateTime” = “date-time with timezone”; “dateTimeOnly” = “local date-time”
- Do not confuse:
dateOnly(no time) ≠dateTimeOnly(date + time, no timezone) ≠dateTime(date + time + timezone/offset)
FAQ:
- Q: What is the difference between
dateTimeOnlyanddateTime? —dateTimeOnlyhas no time zone or offset and cannot represent a precise instant;dateTimeincludes a UTC offset and represents a specific moment in time. - Q: How do I express a duration of 2 days and 3 hours? — Use
toDuration("P2DT3H"). - Q: Can I mix integers and strings in a list expression? — No; all expressions in a list must be the same type.
- Q: How do I create a
dateTimefrom an epoch timestamp in milliseconds? — UsetoDateTime(<epoch in milliseconds>), for exampletoDateTime(1560762190189). - Q: Is
trueorTruethe correct boolean literal? — Use lowercasetrueorfalse; uppercase variants are not valid.