---
schema_version: "1"
id: fac529bac23c4f7f4b02a512db791bb8a23278abf73423474050d045e6857b22
title: now
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/dataweave/2.4/dw-core-functions-now.md
canonical_url: https://docs.mulesoft.com/dataweave/2.4/dw-core-functions-now
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 24462deb0f79798ca76f30180ba41548480e117f5a81a7dcdd5e49f814db6621
description: MuleSoft Documentation Site
release: "2.4"
latest: false
---
---
product: DataWeave
version: 2.4
---

# now

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

## now(): DateTime

Returns a `DateTime` value for the current date and time.

### Example

This example uses `now()` to return the current date and time as a `DateTime` value. It also shows
how to return a date and time in a specific time zone. Java 8 time zones are supported.

#### Source

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

#### Output

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

### Example

This example shows uses of the `now()` function with valid selectors. It also shows how to get the
epoch time with `now() as Number`. For additional examples, see
[Date and Time (dw::Core Types)](https://docs.mulesoft.com/dataweave/latest/dataweave-types#dw_type_dates).

#### Source

```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"}
}
```

#### Output

```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"
}
```
