Python 文件/目录操作

OS模块

sqlite 日期

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
----昨天
select * from 表 where Time>=datetime('now','start of day','-1 day') and Time<datetime('now','start of day','+0 day')

----当天
select * from 表 where Time>=datetime('now','start of day','+0 day') and Time<datetime('now','start of day','+1 day')

----当周
select * from 表 where Time>=datetime('now','start of day','-7 day','weekday 1') AND Time<datetime('now','start of day','+0 day','weekday 1')

----当月
select * from 表 where Time>=datetime('now','start of month','+0 month','-0 day') AND Time < datetime('now','start of month','+1 month','0 day')

----上月
select * from 表 where Time>=datetime('now','start of month','-1 month','-0 day') AND Time <datetime('now','start of month','+0 month','-1 day')