ENH: Improve query performance

Converting into date objects tooked a lot more time than using strftime
to format the necessary dates:

Here's how the old queries performed in a 6,365,487 database:

sqlite> .timer on

sqlite> SELECT COUNT(*) FROM keystrokes WHERE DATE(timestamp) =
DATE('now','localtime');
1727
Run Time: real 3.175 user 2.926497 sys 0.247691
sqlite> SELECT COUNT(*) FROM keystrokes WHERE timestamp >=
strftime('%Y-%m-%d 00:00:00', 'now', 'localtime');
1727
Run Time: real 1.368 user 1.137941 sys 0.230452

sqlite> SELECT COUNT(*) FROM keystrokes WHERE DATE(timestamp) >
DATE('now','-7 day','localtime');
94769
Run Time: real 3.171 user 2.922923 sys 0.248817
sqlite> SELECT COUNT(*) FROM keystrokes WHERE timestamp >=
strftime('%Y-%m-%d 00:00:00', 'now', '-7 day', 'localtime');
113116
Run Time: real 1.400 user 1.161024 sys 0.238614

sqlite> SELECT COUNT(*) FROM keystrokes WHERE DATE(timestamp) >
DATE('now','-30 day','localtime');
572174
Run Time: real 3.289 user 3.029394 sys 0.258767
sqlite> SELECT COUNT(*) FROM keystrokes WHERE timestamp >=
strftime('%Y-%m-%d 00:00:00', 'now', '-30 day', 'localtime');
603311
Run Time: real 1.387 user 1.155033 sys 0.232043

In summary:

*=============================*
| query |   old    |    new   |
*=============================*
| today |  3.1750  |  1.3680  |
*-----------------------------*
| week  |  3.1710  |  1.4000  |
*-----------------------------*
| month |  3.2890  |  1.3870  |
*-----------------------------*

https://i.imgur.com/969iean.jpg