How to get how many days are in the current year?
How do I get how many day开发者_StackOverflow社区s are in the current year (365,366) using Sqlite?
select contact_id as _id,data1,display_name, (strftime('%j',data1)-strftime('%j','now')+365) % 365 as indays from contact_birthday where indays >-200 order by indays asc, display_name asc LIMIT 25
I would like to replace 365 with the valid days for a leap year.
You could compute the difference in days between the start of this year and the start of next year, like so (a bit dirty, though):
sqlite> SELECT julianday('now', 'start of year', '+1 year') - julianday('now', 'start of year');
365
You can use below query for how many days in a year:-
select add_months(trunc(sysdate,'year'), 12) - trunc(sysdate,'year') from dual
精彩评论