On this page
Sommatic Docs
Open portal

Date & Time

The current moment and today, as Luxon DateTime values.

View as Markdown
Open in

Each example was run against the deployed expression engine over the example context at the end of the page.

$now

$now

A Luxon DateTime taken when the node starts resolving its configuration: every expression of one node sees the same moment. It is in the server's time zone, so set the zone you need before formatting or comparing calendar days.

In a pure field, $now keeps its type and the node receives a DateTime; in a mixed field it is inserted as quoted JSON text. Format it yourself (toISO(), toFormat(…)) whenever the result goes into text.

Members

Signature Type Description
$now.toISO() string ISO 8601 date and time with the zone offset.
$now.toISODate() string The date only: yyyy-MM-dd.
$now.toFormat(format) string Text with Luxon tokens: yyyy year, LL month, dd day, HH hour, mm minutes, ss seconds.
$now.toMillis() number Milliseconds since 1970-01-01 UTC.
$now.toSeconds() number Seconds since 1970-01-01 UTC, with decimals.
$now.setZone(zone) DateTime The same moment seen in another IANA zone, such as America/Bogota or UTC.
$now.plus({ days, hours, minutes… }) DateTime A later moment.
$now.minus({ days, hours, minutes… }) DateTime An earlier moment.
$now.startOf(unit) DateTime The start of the year, month, week, day, hour or minute.
$now.endOf(unit) DateTime The last millisecond of that unit.
$now.diff(other, unit) Duration The time between two dates; read it with .as('days') or .toObject().
$now.weekday number Day of the week, 1 (Monday) to 7 (Sunday). Also year, month, day, hour, minute.
$now.constructor DateTime class The DateTime class itself, to parse dates: $now.constructor.fromISO(text), .fromFormat(text, format), .fromMillis(ms).

Examples

{{ $now.toISO() }}
Result string
"2026-11-26T14:30:00.000Z"
{{ $now.setZone('America/Bogota').toFormat('yyyy-LL-dd HH:mm') }}
Result string
"2026-11-26 09:30"
{{ $now.plus({ days: 3 }).toISODate() }}
Result string
"2026-11-29"
{{ $now.toMillis() }}
Result number
1795703400000

Hours since a date that arrived as ISO text.

{{ $now.diff($now.constructor.fromISO($json.body.created_at), 'hours').as('hours') }}
Result number
29.25

Is it the weekend in Bogotá?

{{ $now.setZone('America/Bogota').weekday >= 6 }}
Result boolean
false

A bare $now in a mixed field is inserted as quoted JSON.

Sent at {{ $now }}
Result string
"Sent at \"2026-11-26T14:30:00.000Z\""

Notes

  • The full list of DateTime methods, getters and static constructors is in the Luxon reference.
  • DateTime is not a global name: reach the class through $now.constructor.

In JSONata Not usable: $$now arrives as an object whose methods JSONata cannot call. Use the JSONata functions $now() and $fromMillis().

$today

$today

Midnight of the current day in the server's time zone: $now.startOf('day'). To get the start of the day in another zone, use $now.setZone(zone).startOf('day'); converting $today would give midnight of the server's day, seen from that zone.

Examples

{{ $today.toISODate() }}
Result string
"2026-11-26"

A due date 30 days from today.

{{ $today.plus({ days: 30 }).toISODate() }}
Result string
"2026-12-26"

The start of today in another zone.

{{ $now.setZone('America/Bogota').startOf('day').toISO() }}
Result string
"2026-11-26T00:00:00.000-05:00"

In JSONata Not usable from JSONata, for the same reason as $now.

Example context

The examples run over this data: the input of the current node ($json), the nodes that already ran ($(…)), the ids of the run and the current node. The clock is fixed at 2026-11-26T14:30:00.000Z and the server zone is UTC, so $now and $today give the same values on every page.

Input of the current node JSON
{
  "$json": {
    "body": {
      "order_id": "ord_1042",
      "email": "[email protected]",
      "customer": {
        "name": "Ana Pérez",
        "segment": "gold"
      },
      "priority": "",
      "items": [
        {
          "sku": "A-100",
          "qty": 2,
          "price": 10.5
        },
        {
          "sku": "B-200",
          "qty": 0,
          "price": 4
        },
        {
          "sku": "C-300",
          "qty": 1,
          "price": 25
        }
      ],
      "tags": [
        "new",
        "web",
        "new"
      ],
      "created_at": "2026-11-25T09:15:00Z"
    },
    "headers": {
      "content-type": "application/json"
    },
    "query": {},
    "method": "POST"
  }
}
Nodes that already ran (label → output) JSON
{
  "Webhook Receiver": "= $json",
  "Normalize input": {
    "correlation_id": "c-7f3a",
    "channel": "web"
  },
  "Classify": {
    "label": "billing",
    "confidence": 0.92
  }
}
Run and current node JSON
{
  "$execution": {
    "id": "fir-xxxx",
    "flow_instance_id": "fi-xxxx",
    "flow_definition_id": "fd-xxxx",
    "flow_version_id": "fv-xxxx",
    "flow_slug": "order-intake"
  },
  "$node": {
    "id": "node-notify",
    "label": "Notify customer"
  }
}

Examples run against the orchestrator at commit 31e874b

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs