Insert date in bd with JDBC Google Script

0

I'm trying to write to the database (MySQL) a lot of data, but in the data of type date the execution of the following error:

  

Can not 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);

I do not need to write timestamp necessarily, any date format is enough, but this format was the last one I tried.

    
asked by anonymous 18.04.2017 / 21:15

1 answer

0

I used the following to do the conversion:

var data = Jdbc.newTimestamp(base.getRange(i,3).getValue());
    
19.04.2017 / 14:37