lundi 4 mai 2015

SQLlite query to get data between 2 Datetime

I am using below query to get data from DB between a start time(it is 2hours from start time) and end time mentioned, but this query does not seem to work.

The column REC_CONT_TIME is datetime in the format YYYY-MM-DD HH:MM

Query is:

SELECT * FROM REC_CONTACT WHERE datetime('now')

BETWEEN

strftime('%Y-%m-%d %H:%M:%S',REC_CONT_TIME)

AND

datetime(strftime('%Y-%m-%d %H:%M:%S',REC_CONT_TIME),'+120 minutes')

Start time: strftime('%Y-%m-%d %H:%M:%S',REC_CONT_TIME)

End time: datetime(strftime('%Y-%m-%d %H:%M:%S',REC_CONT_TIME),'+120 minutes'). Added 120 minutes from start time.

Aucun commentaire:

Enregistrer un commentaire