---
schema_version: "1"
id: 9be116fb8acd4510a28982616077fec1ff3b66b02ca21388450c6729c906a294
title: atBeginningOfYear
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-dates-functions-atbeginningofyear.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-dates-functions-atbeginningofyear
source_site: docs.mulesoft.com
content_type: documentation
content_hash: d600a64dee93aac606719dcb3ef9a84e335b696168bf85369a0c5a5f4462f05a
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# atBeginningOfYear

## [](#atbeginningofyear1)atBeginningOfYear(dateTime: DateTime): DateTime

`DateTime`​ 値を入力として取得し、入力内で指定された​_年_​の初日の ​`DateTime`​ 値を返します。​`Time`​ 値も ​`00:00:00`​ に設定します。

入力内の月、日、時刻は ​`01-01T00:00:00`​ に変更されます。

_DataWeave バージョン 2.4.0 で導入されました。_

### [](#パラメーター)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>dateTime</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>参照する ​<code>DateTime</code>​ 値。</p>
</div></div></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、​`DateTime`​ 入力 (​`|2020-10-06T18:23:20.351-03:00|`​) を入力内の ​`Year`​ 値 (​`2020`​) の初日の日付に変換します。

#### [](#ソース)ソース

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

#### [](#出力)出力

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

## [](#atbeginningofyear2)atBeginningOfYear(localDateTime: LocalDateTime): LocalDateTime

`LocalDateTime`​ 値を入力として取得し、入力内で指定された​_年_​の初日の ​`LocalDateTime`​ 値を返します。​`Time`​ 値も ​`00:00:00`​ に設定します。

入力内の月、日、時刻は ​`01-01T00:00:00`​ に変更されます。

_DataWeave バージョン 2.4.0 で導入されました。_

### [](#パラメーター-2)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>localDateTime</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>参照する ​<code>LocalDateTime</code>​ 値。</p>
</div></div></td>
</tr>
</tbody>
</table>

### [](#例-2)例

次の例では、​`LocalDateTime`​ 入力 (​`|2020-10-06T18:23:20.351|`​) を入力内の ​`Year`​ 値 (​`2020`​) の初日の日付に変換します。

#### [](#ソース-2)ソース

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

#### [](#出力-2)出力

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

## [](#atbeginningofyear3)atBeginningOfYear(date: Date): Date

`Date`​ 値を入力として取得し、入力内で指定された​_年_​の初日の ​`Date`​ 値を返します。

入力内の月と日は ​`01-01`​ に変更されます。

_DataWeave バージョン 2.4.0 で導入されました。_

### [](#パラメーター-3)パラメーター

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 25%;">
<col style="width: 75%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>date</code></p></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>参照する ​<code>Date</code>​ 値。</p>
</div></div></td>
</tr>
</tbody>
</table>

### [](#例-3)例

次の例では、​`Date`​ 入力 (​`|2020-10-06|`​) を入力内の ​`Year`​ 値 (​`2020`​) の初日の日付に変換します。

#### [](#ソース-3)ソース

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

#### [](#出力-3)出力

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