I have a ‘created’ column which is INTEGER and this is how I insert sqlite date into it:
ContentValues vals = new ContentValues();
vals.put(Column._CREATED_DATE, "strftime('%s','now')");
db.insert(Table.ARTICLE.name, null, vals);
Unbelievably he inserts strftime('%s','now') string into INTEGER column!
What the heck?
EDIT: when I run insert into article (created) values (strftime("%s","now")) in an SQLite browser, proper integer value is inserted…
Add a default value to your table instead, e.g.
This will put unix epoch in _created_date if you do not set its column value when creating the row. If you want a timestamp (e.g. 2012-05-07 13:07:58) you define it as