> For the complete documentation index, see [llms.txt](https://upsolver.gitbook.io/content/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://upsolver.gitbook.io/content/reference-1/functions-and-operators/functions/date-and-time.md).

# Date & Time

This section describes the following date and time functions:

<table><thead><tr><th width="301">Function</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/clilxvipFeAuW824fiGy">ADD_TIME_ZONE_OFFSET</a></td><td>Add a timezone offset to a date. The timezone offset can be in any of the standard formats accepted by Java's ZoneId.of method (America/New_York, +0200, etc.)</td></tr><tr><td><a href="/pages/N18oyjooMSCOqpl20IUM">DATE</a></td><td>Casts string to date</td></tr><tr><td><a href="/pages/l7zO9U81KLAocUlC6lXW">DATE_ADD</a></td><td>Adds an interval value of type unit to timestamp. Subtraction can be performed by using a negative value</td></tr><tr><td><a href="/pages/g6pYL7Ma0ZpAnh9byXNH">DATE_DIFF</a></td><td>Returns timestamp2 - timestamp1 expressed in terms of unit</td></tr><tr><td><a href="/pages/Jg4ejfsahEFLIKHkFMbT">DATE_TRUNC</a></td><td>Truncate a date to a given unit</td></tr><tr><td><a href="/pages/RZoHL1cSJzwRiQumKMHG">DAY</a></td><td>Returns the day of the month from the timestamp</td></tr><tr><td><a href="/pages/v3l4bVlFkQhn36i8LqPy">DAY_OF_WEEK</a></td><td>Returns the ISO day of the week from the timestamp. values range from 1 (Monday) to 7 (Sunday)</td></tr><tr><td><a href="/pages/btaH1SbZfcldh0NIQgpo">DAY_OF_YEAR</a></td><td>Returns the day of the year from timestamp. values range from 1 to 366</td></tr><tr><td><a href="/pages/WywE0PcaxVTSPoXGJv4v">EXTRACT_TIMESTAMP</a></td><td>Convert a date or timestamp string to a date or timestamp, autodetecting the date format</td></tr><tr><td><a href="/pages/Pl00kgpJ54Z5u42aH1z8">FORMAT_DATETIME</a></td><td>Convert a datetime into a string</td></tr><tr><td><a href="/pages/SyB8ZqXy8UcrKOkSHKoX">FROM_ISO8601_DATE</a></td><td>Parses the ISO 8601 formatted string into a date</td></tr><tr><td><a href="/pages/JYgkE5neMrAfRV5bZHOI">FROM_UNIXTIME</a></td><td>Convert epoch seconds to a timestamp</td></tr><tr><td><a href="/pages/LPPAzzfqoXKiOgk7Uur1">HOUR</a></td><td>Returns the hour of the day from a timestamp. Values range from 0 to 23</td></tr><tr><td><a href="/pages/v70iWPRxLMwcRvZgVN8O">MILLISECOND</a></td><td>Returns the millisecond of the second from the timestamp</td></tr><tr><td><a href="/pages/kSCAmNX3MEVPricDyP2O">MINUTE</a></td><td>Returns the minute of the hour from the timestamp</td></tr><tr><td><a href="/pages/JE3K2RG1Evn0XpiFXeaA">MONTH</a></td><td>Returns the month of the year from the timestamp</td></tr><tr><td><a href="/pages/SFGX66YNXwDEPE6nGqmI">QUARTER</a></td><td>Returns the quarter of the year from the timestamp. Values range from 1 to 4</td></tr><tr><td><a href="/pages/tqteJI9lbpt2eclMsAIY">RUN_END_TIME</a></td><td>Returns the job execution end time</td></tr><tr><td><a href="/pages/6Ve6BhwyOnQxDDAqss8I">RUN_START_TIME</a></td><td>Returns the job execution start time</td></tr><tr><td><a href="/pages/7xGoN8vBZ8E58HxUqByb">SECOND</a></td><td>Returns the second of the minute from the timestamp</td></tr><tr><td><a href="/pages/u58C5dQYfcMPcrVqh9wO">SUBTRACT_TIME_ZONE_OFFSET</a></td><td>Subtract a timezone offset from a date. The timezone offset can be in any of the standard formats accepted by Java's <code>ZoneId.of</code> method (America/New_York, +0200, etc)</td></tr><tr><td><a href="/pages/39G6ho3VrstXKRvpSEgi">TO_UNIXTIME</a></td><td>Convert a date to its Epoch (Unix) seconds representation, with fractional milliseconds</td></tr><tr><td><a href="/pages/8Azbfj40v5EaJH99Ymfq">TO_UNIX_EPOCH_MILLIS</a></td><td>Convert a date to its Epoch (Unix) seconds representation</td></tr><tr><td><a href="/pages/0y0VVhLFQMBo0P2fN8Uc">TO_UNIX_EPOCH_SECONDS</a></td><td>Convert a date to its Epoch (Unix) seconds representation</td></tr><tr><td><a href="/pages/ZP6CjO9jQ0jO5oVKdQ38">WEEK</a></td><td>Returns the ISO week of the year from the timestamp. Values range from 1 to 53</td></tr><tr><td><a href="/pages/MEhJOZFDWafOg2UKG11H">YEAR</a></td><td>Returns the year from the timestamp</td></tr><tr><td><a href="/pages/C4iIctMUEVPDHg69vz5I">YEAR_OF_WEEK</a></td><td>Returns the year of ISO week from the timestamp</td></tr></tbody></table>


---

# 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://upsolver.gitbook.io/content/reference-1/functions-and-operators/functions/date-and-time.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.
