Can someone please point me in the right direction (Date/Time conversion)

I am running an HTTP request that returns me a list of time(slots). I need to convert this list into more easily understood list, such as Just the date YYYY-MM-DD and the Start Time in two separate columns.

I am looking for the expression values that I need to put in the set node that can help me display these values as YYYY-MM-DD and as human readable time, such as 4 PM

Can someone please help me with the right expression or point me to the article that can help me understand this. I can do with a $now value but using these values (that are coming from elsewhere) is beyond me at this point.

Here is a screenshot to explain this better (and to show the time values as they are coming)

Describe the issue/error/question

What is the error message (if any)?

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Look at the DateTime node - it has a conversion feature

Thank you @treyr. I am using those but I have to use 6 of those, whereas if I knew how to convert, I can have a much cleaner workflow with just one set node. ALSO, using the date and time node somehow offsets the timezone

Hi there,

You can do a lot with luxon in expressions as well.
Have a look at:

Happy to say that autocomplete inside expressions for functions is on our roadmap, and right near the top :grinning:

We’ve done some early discover - its likely that first version will have type aware suggestions. That is, when you type a . you’ll be shown a list of functions for that type. So for date time types, that would list helper functions for working with dates. Like formatting them :slight_smile: Or for strings, functions to convert to other types, like a date object.

That will be coming after some exciting expression editor improvements coming out imminently (in-line expression editing in the node view)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.