---
schema_version: "1"
id: b789a623205b293207e5d12e678f4ea4d3653ca157094513e09cd2ee888facc0
title: toPeriod
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.4/dw-coercions-functions-toperiod.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.4/dw-coercions-functions-toperiod
source_site: docs.mulesoft.com
content_type: documentation
content_hash: defc97cd4ee088e104e03dcd88e50cbb9b12a906ac26a2f32d7ebcb675ceb9c8
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
# toPeriod

## [](#toperiod1)toPeriod(str: String): Period

`String`​ 値を ​`Period`​ 値に変換します。

_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>Period</code>​ 値に変換する ​<code>String</code>​ 値。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

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

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

```DataWeave
%dw 2.0
import * from dw::util::Coercions
output application/dw
---
{
  toPeriodEx1: toPeriod("P1D"),
  toPeriodEx2: toPeriod("PT1H1M")
}
```

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

```Json
{
  toPeriodEx1: |P1D|,
  toPeriodEx2: |PT1H1M|
}
```