Hi KC,
There is a reference to the w3c site that has the XML references - on the main InfoPathDev page click resources in the right hand side and explore that area. You'll find it. Custom xpath functions is not going to work here. You need qRule's date diff function. It's a piece of cake. Just install the free trial, inject it in your form and open the user guide and search for DateDiff. Add a rule that set's the qRules command to that and pass in the path for the field you want to calculate too. This will work for any leap year etc.
Otherwise, I recommend searching around. I seem to recall a guy in Europe that had a method for doing stuff in xpath but it was pretty convoluted. Nowadays we just use qRules for this.
Disclaimer: Qdabra Software sells qRules for $199 to help defray the cost of supporting this free forum. Your purchase not only helps you get your work done quickly - qRules comes with the top 40 most commonly requested features in InfoPath and you can use it in all of your forms (dev license not client license), but you will feel good about supporting this forum. qRules is very inexpensive and we do offer big discounts for people who send us a 2-3 sentence testimonial and their picture.
Happy trails!