Format a Date

I’m trying to format the date I need, but it gives me the error ERROR: Invalid date format. I don’t understand what’s wrong. I read similar topics on the forum with this error - nothing helped.
I take data from PostgreSQL

[image]

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @KamaR,

It looks the field you have could be a string and possibly has extra characters around it, Can you paste the output of the Edit Fields3 node here so I can take a proper look? It looks like you might have to remove the " from the start and end of the date fields if that is what those characters are.

@Jon

@Jon the start_date column is of type date
image

@KamaR , that is not what Jon is asking for. Could you copy/paste the JSON output the “Edit Fields3 node” (within the pair of triple backticks)? From the screenshot, it appears you have some extra odd-looking quotes around the value which prevents the proper conversion as it does not conform to the date string standard (even though it is a date in your original dataset).

Here’s what I mean

@Jon @ihortom

zooming in on the screen it becomes clear that these are regular double quotes

“2024-01-09T20:00:00.000Z”

Hey @KamaR,

Are those double quotes in your database as well or are we adding them in the Edit Fields / Set node? They are going to be the problem and will need to be removed, I just need to know where they are coming from now.

1 Like

@Jon these quotes are not in the database. These quotes appear in the output of Edit Fields3

grafik

you don’t need to do this, do you?
start_date is already that value.
Can you see if removing those redundancies fixes it?

Edit:
By doing that you’re turning a date into a string
grafik

grafik

3 Likes

how did I not notice this before?))) @atwork1 @Jon thank you for your time

3 Likes

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