mardi 19 mai 2015

SQLite Android - geting month

i´m trying to get all the records within the month.

my date is stored as a TEXT(tryed DATE) and a string in android

my method for get the current date:

   private String getDateTime() {
        SimpleDateFormat dateFormat = new SimpleDateFormat(
                "yyyy-MM-dd HH:mm:ss", Locale.getDefault());
        Date date = new Date();
        return dateFormat.format(date);
    }

and my Cursor:

public Cursor getCursor(){
        return db.rawQuery("Select strftime('%m', " + CN_DATE + ") as valMonth from " + TABLE_NAME + " where valMonth = '05' GROUP BY valMonth)" , null);
    }

Error: near ")": syntax error (code 1): , while compiling: Select...

thx for your help in advance :)

(sorry for my english)

Aucun commentaire:

Enregistrer un commentaire