# $buildDateTime

`$buildDateTime` operator helps you in building timestamp (Datetime, Epoch second, Epoch millisecond). You can use this in any [<mark style="color:blue;">**Expression Object**</mark>](https://docs.cosmocloud.io/flow-builder/cql-cosmocloud-query-language/building-expressions)

## Syntax

```json
{
    "$buildDateTime":{
       "type" : <type>,
       "args" : [ <year> , <month> , <date> ,<hour>, <minutes>, <seconds> ]
    }
}
```

### Properties

<table><thead><tr><th>Field</th><th width="332">Description</th><th>Required</th></tr></thead><tbody><tr><td>type</td><td><p>The <code>&#x3C;type></code>  should be one of </p><p><code>ISO_DATETIME</code> <code>EPOCH_SECOND</code> or <code>EPOCH_MILLISECOND</code></p><p></p><p>It can also be a Magical Autocomplete.</p></td><td>true</td></tr><tr><td>args</td><td>args should be an array of exactly six values of <br><code>[ YYYY, MM , DD , HH , SS ,MS]</code></td><td>true</td></tr></tbody></table>

### Returns

`datetime or integer` - The result of $buildDateTime operation

## Examples

### Basic example

```json
{
    "$buildDateTime": {
        "type" : "EPOCH_SECOND",
        "args": [2024,04,22,0,0,0]
    }
}
```

The above expression returns timestamp of  **1713744000**

### With Nested Expressions

```json
{
    "$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 &#x20;

`[2024,04,22,0,0,0]`  currently.

```json
{
    "$buildDateTime":{
        "type" : "EPOCH_SECOND",
        "args": "$.variables.temp"
    }
}
```

The above expression would resolve to a result of **1713744000**
