Have a look at this topic:
It explains how to create these objects. You can then use them in query conditions instead of prompts or hard-coded dates.