$buildDateTime
$buildDateTime
operator helps you in building timestamp (Datetime, Epoch second, Epoch millisecond). You can use this in any Expression Object
Syntax
{
"$buildDateTime":{
"type" : <type>,
"args" : [ <year> , <month> , <date> ,<hour>, <minutes>, <seconds> ]
}
}
Properties
type
The <type>
should be one of
ISO_DATETIME
EPOCH_SECOND
or EPOCH_MILLISECOND
It can also be a Magical Autocomplete.
true
args
args should be an array of exactly six values of
[ YYYY, MM , DD , HH , SS ,MS]
true
Returns
datetime or integer
- The result of $buildDateTime operation
Examples
Basic example
{
"$buildDateTime": {
"type" : "EPOCH_SECOND",
"args": [2024,04,22,0,0,0]
}
}
The above expression returns timestamp of 1713744000
With Nested Expressions
{
"$buildDateTime": {
"type" : "EPOCH_SECOND",
"args": [
2024,
{ "$pow" : [2,2] },
{ "$add" : [20,2] },
0,
0,
0
]
}
}
The above expression calculates the nested expressions, returns 4 and 22 respectively in its place and then the outer $buildDateTime
expression returns 1713744000 overall.
With Magical Autocomplete
Let's say we have declared a variable temp
of type array in our API flow, which has a value of
[2024,04,22,0,0,0]
currently.
{
"$buildDateTime":{
"type" : "EPOCH_SECOND",
"args": "$.variables.temp"
}
}
The above expression would resolve to a result of 1713744000
Last updated