1

これが私の質問です。sqlite データベースに日付があります。私がやりたいことは次のとおりです。

SELECT dates FROM Table1 WHERE dates > date('now','-1 month');

結果は次のとおりです。

2013-02-21 12:04:22
2013-02-28 12:04:22
2013-02-01 12:04:22

これらの日付を次のように変換するにはどうすればよいですか。

2013-02-21 12:04:22 become 2 (day 2 of the month)
2013-02-28 12:04:22 become 9 (day 9 of the month)
2013-03-01 12:04:22 become 10(day 10 of the month)

前もって感謝します

4

2 に答える 2

3

試す

select julianday(dates) - julianday(date('now','-1 month')) + 1
from table1
where dates > date('now','-1 month')
于 2013-03-20T13:04:42.653 に答える
0
select cast((julianday(dates) - julianday(date('now','-1 month')) + 1)as int)
from table1
where dates > date('now','-1 month')

整数部分のみを保持するには:) AnatolySに感謝します

于 2013-03-20T17:08:15.943 に答える