Adding rows including date and datetime with AppSheet API

Hi,

I’m trying to use an API to add new records to the application table. I am currently facing the challenge of having the correct date format (data type: date and datetime). Do you know maybe how should I use Utilities.formatDate () in Google Apps Script to make the date format match the one required in AppShhet for the Central European Standard Time zone? I’ve already tried with:

Utilities.formatDate(data1[s][3], Session.getScriptTimeZone(), “MM/dd/yyyy hh:mm:ss”), Utilities.formatDate(data2[w][5], Session.getScriptTimeZone(), “MM/dd/yyyy”)

and with:

Utilities.formatDate(data1[s][3], Session.getScriptTimeZone(), “dd/MM/yyyy hh:mm:ss”), Utilities.formatDate(data2[w][5], Session.getScriptTimeZone(), “dd/MM/yyyy”)

Each time I tried to run the script I got an error: “Cannot convert to datetime / date format” (in AppSheet log analyzer).

Any ideas? :slightly_smiling_face:

Jola

@Jolanta_Wencel
It shall be like this:
Utilities.formatDate(new Date(data1[s][3].toString()), Session.getScriptTimeZone(), “dd/MM/yyyy hh:mm:ss”)