sqlite database default time value 'now' sqlite database default time value 'now' sqlite sqlite

sqlite database default time value 'now'


i believe you can use

CREATE TABLE test (  id INTEGER PRIMARY KEY AUTOINCREMENT,  t TIMESTAMP  DEFAULT CURRENT_TIMESTAMP);

as of version 3.1 (source)


according to dr. hipp in a recent list post:

CREATE TABLE whatever(     ....     timestamp DATE DEFAULT (datetime('now','localtime')),     ...);


It's just a syntax error, you need parenthesis: (DATETIME('now'))

If you look at the documentation, you'll note the parenthesis that is added around the 'expr' option in the syntax.