This page explains the data types in APL.
Type | Additional names | gettype() |
---|---|---|
bool() | boolean | int8 |
datetime() | date | datetime |
dynamic() | array or dictionary or any other of the other values | |
int() | int has an alias long | int |
long() | long | |
real() | double | real |
string() | string | |
timespan() | time | timespan |
true
or false
(internally encoded as 1 and 0, respectively), as well as the null value.
bool
data type supports the following operators: equality (==
), inequality (!=
), logical-and (and
), and logical-or (or
).
value
), where a number of formats are supported for value, as indicated by the following table:
Example | Value |
---|---|
datetime(2019-11-30 23:59:59.9) datetime(2015-12-31) | Times are always in UTC. Omitting the date gives a time today. |
datetime(null) | Check out our null values |
now() | The current time. |
now(-timespan) | now()-timespan |
ago(timespan) | now()-timespan |
datetime
value compared with the moment in time when APL started to execute the query.
Format | Example |
---|---|
%Y-%m-%dT%H:%M:%s%z | 2016-06-26T08:20:03.123456Z |
%Y-%m-%dT%H:%M:%s | 2016-06-26T08:20:03.123456 |
%Y-%m-%dT%H:%M | 2016-06-26T08:20 |
%Y-%m-%d %H:%M:%s%z | 2016-10-06 15:55:55.123456Z |
%Y-%m-%d %H:%M:%s | 2016-10-06 15:55:55 |
%Y-%m-%d %H:%M | 2016-10-06 15:55 |
%Y-%m-%d | 2014-11-08 |
Value
)
Value can be:
ListOfValues
]. For example, dynamic([3, 4, “bye”]) is a dynamic array of three elements, two long values and one string value.Name
=Value ...
}. For example, dynamic(\{"a":1, "b":\{"a":2\}\})
is a property bag with two slots, a, and b, with the second slot being another property bag.Value
)
Where Value can take the following forms:
-
) sign followed by one or more digits. For example, long(-3) is the number minus three of type long."
): “This is a string literal. Single quote characters (’) don’t require escaping. Double quote characters (”) are escaped by a backslash (\)”'
): Another string literal. Single quote characters (’) require escaping by a backslash (\). Double quote characters (”) do not require escaping.\
) character indicates escaping. The backslash is used to escape the enclosing quote characters, tab characters (\t
), newline characters (\n
), and itself (\\
).
\
) stands for itself, and does not denote an escape sequence.
""
): @"This is a raw string literal"
'
): @'This is a raw string literal'
@"^[\d]+$"
instead of "^[\\d]+$"
.
(time)
data type represents a time interval.
Value | length of time |
---|---|
’2d | 2 days |
1.5h | 1.5 hour |
30m | 30 minutes |
10s | 10 seconds |
timespan(15s) | 15 seconds |
0.1s | 0.1 second |
timespan(2d) | 2 days |
tobool()
: Converts input to boolean representation.todatetime()
: Converts input to datetime scalar.todouble()
or toreal()
: Converts input to a value of type real.tostring()
: Converts input to a string representation.totimespan()
: Converts input to timespan scalar.tolong()
: Converts input to long (signed 64-bit) number representation.toint()
: Converts input to an integer value (signed 64-bit) number representation.