Insert date in bd with JDBC Google Script

Asked

Viewed 31 times

0

I am trying to write several data in the database (Mysql), but in the data of the date type the following error:

Unable to find setTimestamp(number,string) method. (line 32, file "Code")

The code is:

var data = Utilities.formatDate(base.getRange(i,3).getValue(), "GMT-03:00", "dd-MM-yyyy'T'HH:mm:ss'Z'");
stmt.setTimestamp(3,data);

No need to record timestamp necessarily, any date format is enough, but this format was the last one I tried.

1 answer

0

I used the following to make the conversion:

var data = Jdbc.newTimestamp(base.getRange(i,3).getValue());

Browser other questions tagged

You are not signed in. Login or sign up in order to post.