I want to construct a timestamp from individual elements (year, month, day, hour, minute, second).
The elements are initially coming from a PLC and then I’m writing into a database.
This script (admittedly with some hard-coded values) appears to work:
[code]from datetime import datetime
dt_y = 2016
dt_m = 1
dt_d = 20
dt_h = 12
dt_mn = 34
dt_s = 56
tstamp=datetime(dt_y, dt_m, dt_d, dt_h, dt_mn, dt_s)
sql = “UPDATE mytable SET t_stamp=? WHERE ID=1”
But is this the best way of doing it?