I want to execute a query something like :
INSERT INTO MyTable VALUES(datetime('now'));
Where MyTable
has schema:
CREATE TABLE MyTable(
mydate DATETIME
)
When executed in SQLite Manager query runs perfectly inserting the current datetime value in mydate
column of MyTable
.
But when executed using
ContentValues cv=new ContentValues();
cv.put(MyTable.mydate,"datetime('now')");
getContentResolver.insert(MyTable.CONTENT_URI,cv);
The value in mydate reads datetime('now') and not the actual current date and time.
I am performing all this from a ContentProvider.
How can I fix this ?