…by using query commands?
For which query product?
Query “commands” can’t do anything with dates. They can only access query products, then you can create queries that may work with dates. But different query products do things differently.
The Query/400 product is currently called ‘Query for i5/OS’ or ‘IBM Query for i’, and it may be entered by running the WRKQRY command. The most common alternative query product is Query Manager (which can use SQL), and the STRQM command is a way to enter the product. It’s also common for SQL to be used directly through the STRSQL command.
There are other possibilities, but those are most likely for you.
Can you describe how you get into your query function? We can determine what the product is with a little description from you. We can help better if we know which product you use and which answer to give.