Here is what I have"
<cfformgroup type="horizontal" label="Birth Date:">
<cfinput name="BirthDate" type="text" id="BirthDate" width="100" maxlength="10" required="yes" message="Invalid Birthdate" validate="date">
<cfinput name="Age" type="text" id="Age" width="35" maxlength="3" required="yes" message="Invalid Age" validate="integer" label="Age:">
</cfformgroup>
I need the Age fields value to be populated with the "DateDiff("yyyy", birthdate, Now())" upon the user entering thier Birthdate in the Birthdate Field.
Wil this work? How?
Main Topics
Browse All Topics





by: mrichmonPosted on 2005-09-14 at 13:05:58ID: 14884340
DateDiff("yyyy", birthdate, Now())
should give you the difference in years between now and the day entered. You may also have to adjust for the month as well in case the birthday already occurred.