lundi 26 janvier 2015

Datetime aritmethics in sqlite on android

I am trying to do some datetime aritmethics in Sqllite. I have a table with two rows defined as type DATETIME. These fields are called LOG_FROM and LOG_TO. In a query on this table I try to do the following:



SELECT SUM(LOG_FROM - LOG_TO) AS TIMESPENT FROM LOG_TABLE WHERE X=Y;


This subtraction inside the SUM function does not work as intended. It will always return the number 0. I read the data via a cursor.getString.


When I store dates in the table I convert them to strings on the format yyyy-MM-dd HH:mm:ss


Aucun commentaire:

Enregistrer un commentaire