I am a developer for Cognito Forms
You can do this with the use of two fields. The first field is a Date filed with the label of "Birth Date". This will be the title I use in the calculation in our next field.
The next field we need to add is a Calculation field. You can title this anything you need to and for this example I used "Age" we are then going to use the fallowing calculation in the calculation field.
=DateTime.Today.Year - BirthDate.Year + (DateTime.Today.Month < BirthDate.Month or (DateTime.Today.Month = BirthDate.Month and DateTime.Today.Day < BirthDate.Day) ? -1 : 0)
This will allow a user to input their birth date into the Date field and the users age will be placed as a number onto the form in the Age field.