Since there are no functions in Infopath to do this you have to use Code to do this
public void date_OnValidate(DataDOMEvent e)
{
// Custom data validation because InfoPath does not have functions for date arithmetic
if (e.Operation == "Insert")
{
try
{
DateTime date = DateTime.Parse(e.NewValue.ToString());
if (date.CompareTo(DateTime.Today.AddDays(5)) > 0)
{
e.ReportError(e.Site, "Date cannot be more than 5 days away.",
false, null, 1, "modal");
}
}
catch (FormatException)
{
i hope it helps you