I’m using the following code to insert a row with a timestamp column into a SQLite database:
ContentValues contentValues = new ContentValues();
contentValues.put(LAST_UPDATE, "15-02-2012 11:27:42");
database.insert(TABLE_NAME, null, contentValues );
When I check the table afterwards, the column with the timestamp (defined as timestamp not null) is always null. The other columns (not shown in the code sample) are ok. Any ideas?
you should use the following date format in order to insert dates/times in SQLite:
and retrieve in string as below:
P.S. Make sure your column is of type
DATETIME