---
schema_version: "1"
id: 6732a96e24e8c5789da101957ba70b88e433dc77038e2a0cb818a13b976ecffd
title: toDate
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.6/dw-coercions-functions-todate.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.6/dw-coercions-functions-todate
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 713a9ce1e479fa0b51fe48609716c788c7162e02c27a0959c22e4a386bbe49a8
description: MuleSoft Documentation Site
release: "2.6"
latest: false
---
# toDate

## [](#todate1)toDate(str: String, format: String | Null = null, locale: String | Null = null): Date

`String`​ 値を ​`Date`​ 値に変換して、形式とロケールを受け入れます。

_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>str</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Date</code>​ 値に変換する ​<code>String</code>​ 値。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>format</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>Date</code>​ 値に対して使用する書式設定。
           ​<code>null</code>​ 値は ​<code>Date</code>​ 値に対して無効です。
           このパラメーターでは、ISO-8601 に基づいた Java 文字パターンを受け入れます。​<code>2011-12-03</code>​ などの ​<code>Date</code>​ 値の形式は ​<code>uuuu-MM-dd</code>​ となります。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>locale</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">使用する省略可能な ISO 3166 国コード (​<code>US</code>​、​<code>AR</code>​、​<code>ES</code>​ など)。​<code>null</code>​ または欠落値では JVM のデフォルトが使用されます。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、さまざまな入力での ​`toDate`​ の動作を示します。 `application/dw`​ 形式の出力が生成されます。

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

```DataWeave
%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
  a: toDate("2015-10-01"),
  b: toDate("2003/10/01","uuuu/MM/dd")
}
```

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

```DataWeave
{
  a: |2015-10-01|,
  b: |2003-10-01| as Date {format: "uuuu/MM/dd"}
}
```