> 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/normalize-date-granularity.md).

# Normalize date granularity

The Normalize Date granularity step allows to extract date information (eg. *day*, *week*, *year* etc.) in a column intended for aggregation.

### Step parameters

* `Date column` **(string\*)**: the column on which the date granularity must be applied
* `Date granularity to apply` **column(string)\***: Among ( year, quarter number, month, ISO week (monday to monday), week (sunday to sunday) you can choose one or more date granularity to apply.
* `New column` **column(string)\***: the ending date

{% hint style="info" %}
The following granularities are supported:

* `year`: calendar date corresponding to the first day (1st of January) of the year
* `quarter`: calendar date corresponding to the first day of the quarter
* `month`: calendar date corresponding to the first day of the month
* `week`: calendar date corresponding to the first day of the week (sunday)
* `isoWeek`: calendar date corresponding to the first day of the week (monday)
* `day`: calendar date corresponding to the first hour of the day
  {% endhint %}

### Example

**Input**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-019d9a4f6b06a48caf1299557990d042654799b9%2FCapture%20d%E2%80%99e%CC%81cran%202025-04-23%20a%CC%80%2017.06.25.png?alt=media" alt=""><figcaption><p>Date - Normalize date granularity input</p></figcaption></figure>

**Configuration**

```json
{
  "column": "date",
  "granularity": "year",
  "new_column": "aggregated_date_column",
}

```

**Output**

<figure><img src="https://1809014303-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZxYYf1KpgarKMgMsDCrw%2Fuploads%2Fgit-blob-7df204e9a40f612f7aba091c61b8bdad43717873%2FCapture%20d%E2%80%99e%CC%81cran%202025-04-28%20a%CC%80%2017.25.45.png?alt=media" alt=""><figcaption><p>Date - Normalize date granularity output</p></figcaption></figure>


---

# 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/normalize-date-granularity.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.
