Filter month in QSqlTableModel

3

How do I filter the month in QSqlTableModel ?

I'm doing this:

model = new QSqlTableModel(this);
model->setTable("tabela"); // db sqlite
model->setFilter("strftime('%m', campo_dataCadastro)='04'");//db YYYY/MM/DD HH:MM:SS
model->select();

But to no avail. The setFilter is only for WHERE ?

    
asked by anonymous 23.04.2014 / 17:26

1 answer

1

Resolved, The problem was the date format stored in sqlite . Converts the date to YYYY-MM-DD HH:MM:SS and ran the filter.

    
24.04.2014 / 16:26