MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
May
Sun Mon Tue Wed Thu Fri Sat
   
14
   
2018
Months
May


Mon, May 14, 2018 11:09 pm

Using local time for date calculations in SQLite

I have an SQLite database that I use to track approval of tasks. Every Monday, I need to generate a count of the number of tasks approved from the prior Tuesday through the Monday on which I'm creating the report. The approval dates are stored in the database as an integer and I enter them in the form 2018-05-14. I use the following SQL command in a Python script to determine the number I've approved in the last week:

sql = 'SELECT COUNT(*) FROM Tasks WHERE Approved >= date(CURRENT_DATE,"-6 day")'

But I noticed that the count didn't always include the tasks I approved on the prior Tuesday. E.g., when I ran the script tonight, May 14, the number reported was 5, yet I expected the result to be 7.

[ More Info ]

[/software/database/sqlite] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo