---
schema_version: "1"
id: 6daf1b7c8903ea5e472c1a0bf89dc67b78e27cc244f1a8a5348a554560e02e3f
title: now
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/dataweave/2.5/dw-core-functions-now.md
canonical_url: https://docs.mulesoft.com/jp/dataweave/2.5/dw-core-functions-now
source_site: docs.mulesoft.com
content_type: documentation
content_hash: f77c905baf4fd1d0d5f898d8e6a420dd248359a46b95752c854240d09c87f37f
description: MuleSoft Documentation Site
release: "2.5"
latest: false
---
# now

## [](#now1)now(): DateTime

現在の日付と時刻で ​`DateTime`​ (日時) 値を返します。

### [](#例)例

次の例では、​`now()`​ を使用して、現在の日付と時刻を ​`DateTime`​ (日時) 値として返します。また、特定のタイムゾーンの日時を返す方法も示しています。Java 8 のタイムゾーンがサポートされます。

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

```DataWeave
%dw 2.0
output application/json
---
{
   nowCalled: now(),
   nowCalledSpecificTimeZone: now() >> "America/New_York"
}
```

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

```JSON
{
  "nowCalled": "2019-08-26T13:32:10.64-07:00",
  "nowCalledSpecificTimeZone": "2019-08-26T16:32:10.643-04:00"
}
```

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

次の例では、有効なセレクターによる ​`now()`​ 関数の使用を示します。​`now() as Number`​ でエポック時間を取得する方法も示します。 その他の例は、​ [「日時 (dw::Core 型)」](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_dates)​ を参照してください。

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

```DataWeave
%dw 2.0
output application/json
---
{
  now: now(),
  epochTime : now() as Number,
  nanoseconds: now().nanoseconds,
  milliseconds: now().milliseconds,
  seconds: now().seconds,
  minutes: now().minutes,
  hour: now().hour,
  day: now().day,
  month: now().month,
  year: now().year,
  quarter: now().quarter,
  dayOfWeek: now().dayOfWeek,
  dayOfYear: now().dayOfYear,
  offsetSeconds: now().offsetSeconds,
  formattedDate: now() as String {format: "y-MM-dd"},
  formattedTime: now() as String {format: "hh:m:s"}
}
```

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

```JSON
{
  "now": "2019-06-18T16:55:46.678-07:00",
  "epochTime": 1560902146,
  "nanoseconds": 678000000,
  "milliseconds": 678,
  "seconds": 46,
  "minutes": 55,
  "hour": 16,
  "day": 18,
  "month": 6,
  "year": 2019,
  "quarter": 2,
  "dayOfWeek": 2,
  "dayOfYear": 169,
  "offsetSeconds": -25200,
  "formattedDate": "2019-06-18",
  "formattedTime": "04:55:46"
}
```