Date Time and Locale with SQL

EDIT : It works when I try with prepUpdate as below,

from java.util import Calendar
query = "UPDATE myTable SET date_created = ? WHERE id = 1"
arg = [cal.getTime()]
system.db.runUpdateQuery(query, arg)

But, still looking a way without Prep Query.

Hello There,
We have a Ignition server in French Locale. I am trying to write update queries from Ignition with scripting (I must do this way).

Since, it gave me an errors I tried different ways as below with script console:

1.

query = "UPDATE myTable SET date_created ='2020-08-21 00:00:00' WHERE id = 1"
system.db.runQuery(query)

2.

query = "UPDATE myTable SET date_created ='08-21-2020 00:00:00' WHERE id = 1"
system.db.runQuery(query)

3.

from java.util import Calendar
cal = Calendar.getInstance()
query = "UPDATE myTable SET date_created ='%s' WHERE id = 1"%(cal.getTime())
system.db.runQuery(query)

But, all of them throws different exceptions rejecting to convert the date into JDBC compatible format.

How do I write dateTime to SQL with scripting ?

The Date Format we have working for servers in North America is : 'yyyy-MM-dd HH:mm:ss'

Thanks so much in advance

Don’t. Use the Prep Query or a Named Query. It is almost impossible to handle locales and timezones properly in all cases when using timestamps in string form. If you are converting to/from strings, you are screwing up.