I wish to add the date of the transaction in a DB (SQLite)
date = db.execute("""SELECT date('now')""")[0]["date('now')"]
But the date is only in format: 2020-02-18
I need YYYY-MM-DD-HH-SS
I've try:
SELECT date('%Y-%m-%d %H-%M-%S','now');
But I got error.
What is the good syntax?
datetime('now')
will give the date in "YYYY-MM-DD HH:MM:SS" format. Here is sqlite date time doc. – DinoCoderSaurus Feb 18 '20 at 20:45SELECT datetime('now')
works in sqlite3 and phpLiteAdmin. sqlite returns UTC. Don't know about python, you'd have to research that. – DinoCoderSaurus Feb 19 '20 at 20:29