Quantcast
Viewing latest article 6
Browse Latest Browse All 18

SQLite - default a datetime field to the current time (now)

SQLite FAQ: How do I default a SQLite datetime field to the current date and time? (i.e., how do I default it to now?)

Just use the SQLite current_timestamp function, like this:

last_updated datetime default current_timestamp

In a more complete create table example I just used on an Android project, this looks like this:

read more


Viewing latest article 6
Browse Latest Browse All 18

Trending Articles