Contact Free trial Login


now(): DateTime

Returns a DateTime object with the current date and time.


This example shows uses of the now() function with valid selectors. It also shows how to get the epoch time with now() as Number. See also, DataWeave Selectors.


%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


  "now": "2018-07-23T22:03:04.829Z",
  "epochTime": 1533143270,
  "nanoseconds": 829000000,
  "milliseconds": 829,
  "seconds": 4,
  "minutes": 3,
  "hour": 22,
  "day": 23,
  "month": 7,
  "year": 2018,
  "quarter": 3,
  "dayOfWeek": 1,
  "dayOfYear": 204,
  "offsetSeconds": 0