How to check for invalid dates when using FullYearsBetween function?

I’m trying to use the function FullYearsBetween to calculate the years between a person’s date of birth (reported as 3 separate fields for year, month and day using single-select question with combo box to limit choices). Since it is possible to have missing information or a day value that is not legitimate for a given month or year-month combination, the FullYearsBetween function does not always return a value.

Is there a way to test for a legitimate date, use the function when the date is good, and assign a specific value when the date is bad?

This is my current syntax (without any validation):

FullYearsBetween((new DateTime((int)P6_DOB_Year, (int)P6_DOB_Month, (int)P6_DOB_Day)),(new DateTime((int)2020, (int)05, (int)01)))

Yes, you can use the function IsDate(Y,M,D) to test if the three values make a valid date.

Alternatively protect against missings with the ?? operator:
new DateTime(Y??2000,M??07,D??15)
defaults to year 2000, month July, and day 15th if the corresponding component is missing.

Best, Sergiy

Thank you. The IsDate function works perfectly for what I want to do.