# $getHour

`$getHour` operator returns you the hour of the datetime. You can use this in any [Expression Object](https://docs.cosmocloud.io/concepts-and-in-depth/cql-cosmocloud-query-language/building-expressions)

## Syntax

```
{
    "$getHour": [<datetime_like_obj>]
}
```

## Properties

| Field                  | Description                                                                                                                                                                         | Required |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| \<datetime\_like\_obj> | <p>The \<datetime\_like\_obj> expression can be any valid expression as long as it resolves to datetime objects.<br><br>It can also be a <strong>Magical Autocomplete</strong>.</p> | true     |

## Returns

`integer` - The hour of the datetime provided

## Examples

### Basic Example

```
{
    "$getHour": ["2024-07-17 06:34:53"]
}
```

The above expression returns **6**

### With Magical Autocomplete

Let's say we have declared a variable `temp` of type `datetime` which has value of `2024-07-17 06:34:53` currently.

```
{
    "$getHour": [ "$.variables.temp" ]
}
```

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


---

# 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/usdgethour.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.
