> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/code/cookbook/luxon.md).

# Work with dates using Luxon in Duaer

Dates in a Duaer expression are Luxon DateTime values. $now and $today already are. The Code node uses native Luxon—format() and plus(amount, unit) do not carry over unchanged.
## How a Duaer expression gets a DateTime

$now is the current time. $today is the start of today. An existing string uses DateTime.fromISO, or toDateTime() on the value.

```
{{ $now.toFormat("yyyy-MM-dd") }}
{{ $json.createdAt.toDateTime().plus(7, "days").toISO() }}
```

## Native Luxon in the Code node is different

- format() in an expression is a Duaer extension. In the Code node, format with toFormat().
- In an expression, plus and minus accept (amount, unit), such as plus(7, "days"). Native Luxon in the Code node wants plus({ days: 7 }). Two arguments may not throw, and still will not add the days you wanted.
- Several statements belong in an immediately invoked function. See [Transform data with expressions in Duaer](/code/expressions.md).
## Questions

### How do you get today’s date string in Duaer?

In a Duaer expression, write {{ $now.toFormat("yyyy-MM-dd") }}. $now is a Luxon DateTime. To pin a time zone, call setZone before toFormat.

### Why does the same plus call give the wrong result in the Duaer Code node?

A Duaer expression accepts plus(7, "days"). The Code node uses native Luxon and wants plus({ days: 7 }). Two arguments may not throw, and still will not add those 7 days.

## Related

- [Date transformation methods in Duaer](https://doc.duaer.com/code/builtin/data-transformation-functions/dates.md)
- [Use convenience methods in Duaer expressions](https://doc.duaer.com/code/builtin/convenience.md)
- [Transform data with expressions in Duaer](https://doc.duaer.com/code/expressions.md)

