> For the complete documentation index, see [llms.txt](https://docs-v3.toucantoco.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm/date/extract-date-information.md).

# Extract date information

The Extract date information step allows to extract date information from a date column (e.g. the `year` or the `month`).

### Step parameters

* `Date column` **column(string)\***: specify the date column to extract information from (the column must be of date data type),
* `Date information to extract...` **array(string)\***: the type of information to extract (e.g. `year`, `month`). You can select several information to extract at once.

### Example

**Input**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-ea19e8d8b6bc18b5733e8e4fdeaaa142b1d47387%2Fdate_uat.png?alt=media" alt=""><figcaption><p>Date - Extract date information</p></figcaption></figure>

**Configuration**

```json
{
  "column": "date_column",
  "date_info": ["year", "month", "days"],
}
```

**Output**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-1c9073879bc5c33f16d655f764d5c5cc5e7e2c75%2Fdate_extract_date_info.png?alt=media" alt=""><figcaption><p>Date - Extract date information output</p></figcaption></figure>

{% hint style="info" %}
The following information can be extracted:

* `year'`: extract ‘year’ from date,
* `month`: extract ‘month’ from date,
* `day`: extract ‘day of month’ from date,
* `week`: extract ‘week number’ (ranging from 0 to 53) from date,
* `quarter`: extract ‘quarter number’ from date (1 for Jan-Feb-Mar)
* `day of week`: extract ‘day of week’ (ranging from 1 for Sunday to 7 for Staurday) from date,
* `day of year`: extract ‘day of year’ from date,
* `ISO year`: extract ‘year number’ in ISO 8601 format (ranging from 1 to 53) from date.
* `ISO week`: extract ‘week number’ in ISO 8601 format (ranging from 1 to 53) from date.
* `ISO day of week`: extract ‘day of week’ in ISO 8601 format (ranging from 1 for Monday to 7 for Sunday) from date,
* `first day of year`: calendar date corresponding to the first day (1st of January) of the year ,
* `first day of month`: calendar date corresponding to the first day of the month,
* `first day of week`: calendar date corresponding to the first day of the week,
* `first day of quarter`: calendar date corresponding to the first day of the quarter,
* `first day of ISO week`: calendar date corresponding to the first day of the week in ISO 8601 format,
* `previous day`: calendar date one day before the target date,
* `first day of previous year`: calendar date corresponding to the first day (1st of January) of the previous year,
* `first day of previous month`: calendar date corresponding to the first day of the previous month,
* `first day of previous week`: calendar date corresponding to the first day of the previous week,
* `first day of previous ISO week`: calendar date corresponding to the first day of the previous ISO week,
* `first day of previous quarter`: calendar date corresponding to the first day of the previous quarter,
* `previous year number`: extract previous ‘year number’ from date,
* `previous month number`: extract previous ‘month number’ from date,
* `previous week number`: extract previous ‘week number’ from date,
* `previous quarter number`: extract previous ‘quarter number’ from date,
* `previous ISO week number`: extract previous ‘week number’ in ISO 8601 format (ranging from 1 for Monday to 7 for Sunday)from date,
* `hour`: extract ‘hour’ from date,
* `minutes`: extract ‘minutes’ from date,
* `seconds`: extract ‘seconds’ from date,
* `milliseconds`: extract ‘milliseconds’ from date,
  {% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs-v3.toucantoco.com/data-management-in-datahub/datasets-in-toucan/preparing-data/overview-of-youprep-tm/date/extract-date-information.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
