Date not insertable

I am having the same problem as in the topic Date not insertable/updateable

I am trying to bulk insert records from a table in reetol into my MySQL database but the date format is incorrect in the table, "Incorrect date value: '2023-07-11T02:10:41Z' "

I tried this code{{ table1.recordUpdates.map(row => Object.assign(_.omit(row, ["status"]), {date: moment(row.date).format("YYYY-MM-DD")}) }} in the "Array of records to insert" box. But I get the error "An unexpected error has been found, please make sure your JS syntax is correct"

How should I proceed? Thanks!

Hey @Hugh! The answer in that post contains javaScript that is very specific to their use case and data, so it's not going to work for you here.

Can you share what data type the column is in your MySQL db (ie: DATE, DATETIME, TIMESTAMP)?

It looks like you are sending a time along with the date which the MySQL DATE type does not support, but hard to tell from the information provided.
"Incorrect date value: '2023-07-11T02:10:41Z' "

Is the original data coming from the MySQL db?

1 Like

Hey Joe,

The solution I found was to use the code below:

{{table1.data.map(x=>{return {'Date_Sampled': moment(x.Date_taken).format("YYYY-MM-DD") } })}}
1 Like