Format Current Date as YYYY-MM-DD in n8n using Luxon
You are inserting a record into a database that strictly requires the current date in 'YYYY-MM-DD' format using n8n's built-in $now variable.
Incoming Payload / Data:
// Built-in n8n variable: $now // Returns current DateTime object
Press Enter or click Check Answer. +10 XP
β Solution & explanation
Output: 2026-11-08 (today's date)
$now is a Luxon DateTime object. toFormat() takes a token pattern where yyyy = 4-digit year, MM = month and dd = day. toISODate() is a shortcut that always returns yyyy-MM-dd.π‘ Pro tip: Case matters in Luxon: MM is month but mm is minutes, and DD is a localized date β not the day number.
Also accepted: toFormat("yyyy-MM-dd"), toISODate(), format('yyyy-MM-dd')