I have this code snippet in a view:
time_from = datetime.strptime(req.POST['time_from'], "%Y-%m-%d %H:%M:%S.%f")
with connections["mssql_database"].cursor() as cursor:
sql_statement = "EXEC SaveActivity @TimeFrom='%s'" % (time_from)
print(sql_statement)
cursor.execute(sql_statement)
It prints this SQL
statement:
EXEC SaveActivity @TimeFrom='2021-12-01 08:34:54'
Microseconds are missing. They are zeros, but I need them in a database. How can I correct this?