1

I need to get the Sqlite date difference. I found a way like this

sqlite> SELECT julianday('now') - julianday('1776-07-04');

But this gives the output like this. 86798.7094695023. I want to show it as 86798 the number of days only.

Please help me on this.

tenten
  • 1,276
  • 2
  • 26
  • 54

1 Answers1

2

You can try casting your expression to an Integer if you only want whole number days:

SELECT CAST(JULIANDAY('now') - JULIANDAY('1776-07-04')) As INTEGER

See here for more information.

Community
  • 1
  • 1
Tim Biegeleisen
  • 502,043
  • 27
  • 286
  • 360