# $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>](/flow-builder/cql-cosmocloud-query-language/building-expressions.md)

## 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**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cosmocloud.io/flow-builder/cql-cosmocloud-query-language/building-expressions/usdbuilddatetime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
