This is fairly common and too bad that InfoPath has not put a function in to support this so you have to use script.
There are a couple different approaches but I have used a pretty simple vbscript using the DateDiff function. Here is a pretty good thread. http://www.infopathdev.com/forums/thread/9236.aspx
First if you have not used code yet is the syntax of referencing your fields and the second is using the Datediff function. You should be able to search on both and get the answers you need.
Here is a sample I had in the onload event to calculate 90 days in advance from today to show imminent items.
Pasting did not work so well so i have attached it.