vendredi 24 avril 2015

Need sqlite Query with substring

I want to fetch records from sqlite database table called messages. I have a column named like Message_dated in the form of following "Jan 20, 2015 10:31:23". But in the cursor it is giving as it is.But now i want only date from message_dated column i dont want time.I am using to call query like following.But it is giving full date and time.

ColumnName = DatabaseHelper.TABLE_MSGS.COL_MESSAGE_DATED,
ColumnId =  DatabaseHelper.TABLE_MSGS.COL_MESSAGE_DATED
String[] columns = new String[] {
                DatabaseHelper.TABLE_MSGS.COL_MESSAGE_ID + " as _id",
                columnName, columnID };
cursor = db.query(DatabaseHelper.TABLE_MESSAGES_NAME,
                    columns, null, null, columnID, null, null);

Please tell me how can i do it.Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire