> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xdr-3.x/cortex-xdr-3.x-documentation/cortex-xdr-xql/functions/time_frame_end.md).

# time\_frame\_end

**Syntax**

```programlisting
time_frame_end(<time frame>)
```

**Description**

The `time_frame_end()` function returns the timestamp object for the string representation of the end of the time frame configured for the query in the format MMM dd YYYY HH:flag\_mm:ss, such as Jun 8th 2022 15:20:06. You can configure the time frame using the config [timeframe](/cortex-xdr-3.x/cortex-xdr-3.x-documentation/cortex-xdr-xql/stages/config/timeframe.md) function, where the range can be relative or exact.

If the time frame is relative, for example last 24H, the function returns the [current\_time](/cortex-xdr-3.x/cortex-xdr-3.x-documentation/cortex-xdr-xql/functions/current_time.md). This function is useful when the query uses a custom time frame whose end time is in the past.

**Example 1 - Relative Time**

For the last 5 days from when the query is sent, returns a maximum of 100 `xdr_data` records with the events of the \_time field with a new field called "x". The "x" field lists the final timestamp at the end of 5 days from when the query was sent for the events in descending order. For more information on this relative timeframe range, see the config [timeframe](/cortex-xdr-3.x/cortex-xdr-3.x-documentation/cortex-xdr-xql/stages/config/timeframe.md) function.

```programlisting
config timeframe = 5d
| dataset = xdr_data
| alter x = time_frame_end()
| fields x
| sort desc x
```

**Example 2 - Relative Time**

For the last 5 days from when the query is run until now, returns a maximum of 100 xdr\_data records with the events of the \_time field with a new field called "x". The "x" field lists the final timestamp at the end of 5 days from when the query runs for the events in descending order. For more information on this relative time frame range, see the config [timeframe](/cortex-xdr-3.x/cortex-xdr-3.x-documentation/cortex-xdr-xql/stages/config/timeframe.md) function.

```programlisting
config timeframe = between "5d" and "now"
| dataset = xdr_data
| alter x = time_frame_end()
| fields x
| sort desc
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xdr-3.x/cortex-xdr-3.x-documentation/cortex-xdr-xql/functions/time_frame_end.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
