---
schema_version: "1"
id: 3a90e446421be0e230d4f2fde823734876bb89b892616e299877b8e88a044fd5
title: 秒
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.4/dw-periods-functions-seconds.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.4/dw-periods-functions-seconds
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c4fc4b45fef068282f2b4c60d686e94e18359f7274e36defe78e81c9e03499f7
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
# 秒

## [](#seconds1)seconds(nSecs: Number): Period

指定された秒数から 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>nSecs</code></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">整数または小数としての秒数。
            正または負の数値が有効です。</p></td>
</tr>
</tbody>
</table>

### [](#例)例

次の例では、さまざまな入力での ​`seconds`​ の動作を示します。 DateTime (日時) 値に対して秒数を加算および減算します。また、小数値 ​`4.555`​ を Period (期間) 形式 (​`PT4.555S`​) に、整数 ​`4`​ を Period (期間) 形式 (​`PT4S`​) にも変換します。

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

```DataWeave
%dw 2.0
import * from dw::core::Periods
output application/json
---
{
  nextSecond: |2020-10-05T20:22:34.385Z| + seconds(1),
  previousSecond: |2020-10-05T20:22:34.385Z| - seconds(1),
  decimalInputPeriod: seconds(4.555),
  wholeNumberInputPeriod: seconds(4),
  addNegativeValue: seconds(-1) + seconds(2)
}
```

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

```Json
{
  "nextSecond": "2020-10-05T20:22:35.385Z",
  "previousSecond": "2020-10-05T20:22:33.385Z",
  "decimalInputPeriod": "PT4.555S",
  "wholeNumberInputPeriod": "PT4S",
  "addNegativeValue": 1
}
```