---
schema_version: "1"
id: d17fea6e5f015e6173f755179a514d2fb07195b6ce9a5ff39533e018a6349e81
title: atBeginningOfMonth
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.12/dw-dates-functions-atbeginningofmonth.md
canonical_url: https://docs.mulesoft.com/dataweave/2.12/dw-dates-functions-atbeginningofmonth
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 287cd0010e5f9d134131b4ca693587643d38fd8257790d91825206032289b786
description: MuleSoft Documentation Site
release: "2.12"
latest: false
---
---
product: DataWeave
version: 2.12
---

# atBeginningOfMonth

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

## atBeginningOfMonth(dateTime: DateTime): DateTime

Returns a new `DateTime` value that changes the `Day` value from the input to the first day of the
specified _month_. It also sets the `Time` value to `00:00:00`.

The day and time in the input changes to `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 changes the `Day` value within the `DateTime` input to the first day of the specified
month and sets the `Time` value to `00:00:00`.

#### Source

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

#### Output

```Json
{
  "atBeginningOfMonthDateTime": "2020-10-01T00:00:00-03:00"
}
```

## atBeginningOfMonth(localDateTime: LocalDateTime): LocalDateTime

Returns a new `LocalDateTime` value that changes the `Day` and `LocalTime` values from the input to
the beginning of the specified _month_.

The day and time in the input changes to `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 changes the `Day` and `LocalTime` values within the `LocalDateTime` input to the
beginning of the specified month.

#### Source

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

#### Output

```Json
{
  "atBeginningOfMonthLocalDateTime": "2020-10-01T00:00:00"
}
```

## atBeginningOfMonth(date: Date): Date

Returns a new `Date` value that changes the `Day` value from the input to the first day of the
specified _month_.

The day in the input changes to `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 changes the `Day` value within the `Date` input to the first day of the specified
month.

#### Source

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

#### Output

```Json
{
  "atBeginningOfMonthDate": "2020-10-01"
}
```
