SQL Cast Datetime

OK, so I’ve got a SQL Insert inside of a loop and I want ALL of the Inserts to use the same timestamp so I’ve concluded that I should
use something like :

time = datetime.datetime.now()

outside the loop

and inside:

system.db.runUpdateQuery("UPDATE table SET count = 0, t_stamp = CAST('%s' AS datetime) WHERE type = '%i'"% (time, typeID))

I am not converting the datetime type correctly…

I found my mistake
I needed:

time = now.strftime('%Y-%m-%d %H:%M:%S')