Friday, May 24, 2013

[android help] How to add date in sqlite database


I have sqlite database



private static final String DB_PROCESS_CREATE = "create table "
+ DB_TABLE_PROCESS + "(" + PROCESS_ID
+ " integer primary key autoincrement, "
+ PROCESS_DATE + " date);";


I create it `db.execSQL(DB_PROCESS_CREATE);


How to add date value in this datebase? I tried :



String date = new SimpleDateFormat("yyyy.MM.dd").format(Calendar
.getInstance().getTime());
ContentValues cv = new ContentValues();
cv.put(db.PROCESS_DATE,Date.valueOf(date));
db.mDB.insert(db.DB_TABLE_PROCESS, null, cv));


But then I get error "The method put(String, String) in the type ContentValues is not applicable for the arguments (String, Date)".



.

stackoverflow.comm

No comments:

Post a Comment

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...