---
schema_version: "1"
id: 544a3b93831922e8edafe1ae5ff989284c0978f136754bf814b3a910412d29aa
title: atBeginningOfHour
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.6/dw-dates-functions-atbeginningofhour.md
canonical_url: https://docs.mulesoft.com/dataweave/2.6/dw-dates-functions-atbeginningofhour
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 8a0c2f1cf604dfb84a38fb78f3a5d39c6bf7fba1ad0d92b8e152648c8f008267
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
---
product: DataWeave
version: 2.6
---

# atBeginningOfHour

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

## atBeginningOfHour(dateTime: DateTime): DateTime

Returns a new `DateTime` value that changes the `Time` value in the input to the beginning of the
specified _hour_.

The minutes and seconds in the input change to `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 `Time` value within the `DateTime` input to the beginning of the specified
_hour_.

#### Source

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

#### Output

```Json
{
 "atBeginningOfHourDateTime": "2020-10-06T18:00:00-03:00"
}
```

## atBeginningOfHour(localDateTime: LocalDateTime): LocalDateTime

Returns a new `LocalDateTime` value that changes the `Time` value in the input to the beginning of
the specified _hour_.

The minutes and seconds in the input change to `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 `Time` value within the `LocalDateTime` input to the beginning of the
specified hour.

#### Source

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

#### Output

```Json
{
 "atBeginningOfHourLocalDateTime": "2020-10-06T18:00:00"
}
```

## atBeginningOfHour(localTime: LocalTime): LocalTime

Returns a new `LocalTime` value that changes its value in the input to the beginning of the
specified _hour_.

The minutes and seconds in the input change to `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>localTime</code></p></td><td><div><div><p>The <code>LocalTime</code> value to reference.</p></div></div></td></tr></tbody></table>

### Example

This example changes the `LocalTime` value to the beginning of the specified hour.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
   "atBeginningOfHourLocalTime": atBeginningOfHour(|18:23:20.351|)
}
```

#### Output

```Json
{
 "atBeginningOfHourLocalTime": "18:00:00"
}
```

## atBeginningOfHour(time: Time): Time

Returns a new `Time` value that changes the input value to the beginning of the specified _hour_.

The minutes and seconds in the input change to `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>time</code></p></td><td><div><div><p>The <code>Time</code> value to reference.</p></div></div></td></tr></tbody></table>

### Example

This example changes the `Time` value to the beginning of the specified hour.

#### Source

```DataWeave
%dw 2.0
import * from dw::core::Dates
output application/json
---
{
   "atBeginningOfHourTime": atBeginningOfHour(|18:23:20.351-03:00|)
}
```

#### Output

```Json
{
 "atBeginningOfHourTime":  "18:00:00-03:00"
}
```
