· Dan · snippets · 1 min read
ConnectWise Date Formats in n8n
Luxon date format snippets for n8n
Here’s a cheat-sheet on manipulating dates in n8n using the built-in Luxon library.
ConnectWise Date Formats
The ConnectWise API requires they be in the format [2016-08-20T18:04:26Z]
It must be in the UTC format (ends in Z) and not contain milliseconds. Note that in some cases, just a simple YYYY-MM-DD does work.
Some special variables in n8n. See more n8n documentation $today = Just the date. An easy way to strip out the time info. $now = Full timestamp.
Tomorrow’s date:
{{ $today.plus({days:1}).toUTC().toISO({suppressMilliseconds: true}) }}
Subtract 1 hour from right now:
{{ $now.set({ millisecond: 0 }).minus({ hours: 1 }).toUTC().toISO({ suppressMilliseconds: true }); }}
Convert From the ConnectWise Format to a DateTime Object
{{ DateTime.fromISO("2024-05-23T10:00", { zone: 'PST' }).toUTC().toISO({ suppressMilliseconds: true }) }}
Pretty Format
{{ DateTime.fromISO($json.dateResponded).toRelative({ unit: "hours", round: false }) }}
Turns it into an easy to read relative time string.