---
schema_version: "1"
id: 9d394950723b50975ba80779c7d343f689c773e7f944deccd2e67ad9fd8343ba
title: atBeginningOfYear
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.11/dw-dates-functions-atbeginningofyear.md
canonical_url: https://docs.mulesoft.com/dataweave/2.11/dw-dates-functions-atbeginningofyear
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 383e57cb8b721b92cbb04a7efc3e1b86852e208c7688575eaeebd72d675596d4
description: MuleSoft Documentation Site
release: "2.11"
latest: false
---
---
product: DataWeave
version: 2.11
---

# atBeginningOfYear

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## atBeginningOfYear(dateTime: DateTime): DateTime

Takes a `DateTime` value as input and returns a `DateTime` value for the first day of the _year_
specified in the input. It also sets the `Time` value to `00:00:00`.

The month, day, and time in the input changes to `01-01T00:00:00`.

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>dateTime</code></p></td><td><div><div><p>The <code>DateTime</code> value to reference.</p></div></div></td></tr></tbody></table>

### Example

This example transforms the `DateTime` input (`|2020-10-06T18:23:20.351-03:00|`) to the date of the
first day of the `Year` value (`2020`) in the input.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
  atBeginningOfYearDateTime: atBeginningOfYear(|2020-10-06T18:23:20.351-03:00|)
}
```

#### Output

```Json
{
  "atBeginningOfYearDateTime": "2020-01-01T00:00:00.000-03:00"
}
```

## atBeginningOfYear(localDateTime: LocalDateTime): LocalDateTime

Takes a `LocalDateTime` value as input and returns a `LocalDateTime` value for the first day of the
_year_ specified in the input. It also sets the `Time` value to `00:00:00`.

The month, day, and time in the input changes to `01-01T00:00:00`.

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>localDateTime</code></p></td><td><div><div><p>The <code>LocalDateTime</code> value to reference.</p></div></div></td></tr></tbody></table>

### Example

This example transforms the `LocalDateTime` input (`|2020-10-06T18:23:20.351|`) to the date of the
first day of the `Year` value (`2020`) in the input.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
  atBeginningOfYearLocalDateTime: atBeginningOfYear(|2020-10-06T18:23:20.351|)
}
```

#### Output

```Json
{
  "atBeginningOfYearLocalDateTime": "2020-01-01T00:00:00"
}
```

## atBeginningOfYear(date: Date): Date

Takes a `Date` value as input and returns a `Date` value for the first day of the _year_ specified
in the input.

The month and day in the input changes to `01-01`.

_Introduced in DataWeave version 2.4.0._

### Parameters

<table><colgroup><col> <col></colgroup><thead><tr><th>Name</th><th>Description</th></tr></thead><tbody><tr><td><p><code>date</code></p></td><td><div><div><p>The <code>Date</code> value to reference.</p></div></div></td></tr></tbody></table>

### Example

This example transforms `Date` input (`|2020-10-06|`) to the date of the first day of the `Year`
value (`2020`) in the input.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
  atBeginningOfYearDate: atBeginningOfYear(|2020-10-06|)
}
```

#### Output

```Json
{
  "atBeginningOfYearDate": "2020-01-01"
}
```
