---
schema_version: "1"
id: 7b77939353178418a5953fe519f2cc82b05dbf25fb53dc614bbe851b17e46dcc
title: toLocalDateTimeOrNull
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.8/dw-coercions-functions-tolocaldatetimeornull.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.8/dw-coercions-functions-tolocaldatetimeornull
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 9171e4db898c41d9ba7ea110d9ed16d47dd0435f5f30f3a7c108fc669a615fa5
description: MuleSoft Documentation Site
release: "2.8"
latest: false
---
# toLocalDateTimeOrNull

## [](#tolocaldatetimeornull1)toLocalDateTimeOrNull(str: String, formatters: Array<Formatter>): LocalDateTime | Null

変換する特定の値に一致する最初の​`フォーマッター`​を使用して、​`String`​ 値を ​`LocalDateTime`​ 値に変換します。

指定した値に一致する​`フォーマッター`​がない場合、関数は ​`null`​ 値を返します。

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

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

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 20%;">
<col style="width: 20%;">
<col style="width: 60%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<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">String (文字列)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LocalDateTime</code>​ 値に変換する ​<code>String</code>​ 値。</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>formatters</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">Array&lt;Formatter&gt;</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>LocalDateTime</code>​ 値に対して使用する書式設定の​<code>配列</code>​。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

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

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

```DataWeave
%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
  a: toLocalDateTimeOrNull("2003-10-01 23:57:59", [{format: "uuuu/MM/dd HH:mm:ss"}, {format: "uuuu-MM-dd HH:mm:ss"}]),
  b: toLocalDateTimeOrNull("2003-10-01 23:57:59", [{format: "uuuu/MM/dd HH:mm:ss"}])
}
```

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

```DataWeave
{
  a: |2003-10-01T23:57:59| as LocalDateTime {format: "uuuu-MM-dd HH:mm:ss"},
  b: null
}
```