Ask Your Question

query date next 10 days

asked 2019-07-15 20:41:31 +0200

jodybingo gravatar image

updated 2019-07-16 17:30:21 +0200

Hi all, I am using LO 6.4.2. I would like a query that will give me all the info requested between now and now + 10 days. In design view, under my first Date field I have NOW(). What would go in the second Date field? Thanks for any help you can provide - Jody

edit retag flag offensive close merge delete


To give context, I have a query built, when run, the user must enter a start date and an end date and all reservations between those dates are returned. I would like to get rid of the user input parameter and just have the query run and return the next 7 days of reservations

jodybingo gravatar imagejodybingo ( 2019-07-15 20:45:45 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-07-16 15:13:51 +0200

pierre-yves samyn gravatar image

updated 2019-07-17 08:23:48 +0200



The syntax to calculate the addition of a number of days:

  • for firebird: SELECT "Date", DATEADD (10 day to "Date") "Date+10" FROM "Table"
  • for Hsqldb: SELECT "Date", DATEDIFF( 'DD', '1899-12-30', "Date" ) + 10 "Date+10" FROM "Table"

Syntax applied to select with Hsqldb:

DATEDIFF( 'DD', '1899-12-30', "Date" ) >=  DATEDIFF( 'DD', '1899-12-30', CURRENT_DATE ) 
DATEDIFF( 'DD', '1899-12-30', "Date" ) <=  DATEDIFF( 'DD', '1899-12-30', CURRENT_DATE ) + 10


edit flag offensive delete link more


I am on HSQLDB and this SQL returns all my records and just adds 10 days to each entry. I want the query to return my reservations between now and the next 10 days only

jodybingo gravatar imagejodybingo ( 2019-07-16 17:29:05 +0200 )edit

Sorry @jodybingo, I understood the question but, taken over time, I only gave the general syntax for the calculation, not the application to your case... I updated my answer.


pierre-yves samyn gravatar imagepierre-yves samyn ( 2019-07-17 08:25:38 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-07-15 20:41:31 +0200

Seen: 54 times

Last updated: Jul 17