Skip to content
NEWMarketplace and the trig8n Agent: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Building Blocks & Utilities

Building Blocks & Utilities

Work with Dates and Times in n8n

When you run it, it demonstrates calculating, setting and formatting dates and times, such as adding 12 hours.

What it does

### 2.1 Working with an existing time string As items pass between nodes, n8n saves dates as ISO strings. This means that in order to work with the data as a date again, we need to convert it back using DateTime.fromISO('yyyy-mm-dd') . Once doing that, we are able to apply date and time function again such as : {{DateTime.fromISO($json["Now"]).toFormat('yyyy LLL dd')}}

The steps

  1. On clicking 'execute'
  2. 12 Hours from now
  3. Set times
  4. Edit times
  5. Format - MMMM DD YY

Similar automations