1: 2: 3: 4: 5: 6: 7:
If Month(CDate(labelDateJOinedScheme.Text)) < Month(CDate(labelDOB.Text)) Or (Month(CDate(labelDateJOinedScheme.Text)) = Month(CDate(labelDOB.Text)) And Day(CDate(labelDateJOinedScheme.Text)) < Day(CDate(labelDOB.Text))) Then AgeAtSchemeEntry = Year(CDate(labelDateJOinedScheme.Text)) - Year(CDate(labelDOB.Text)) - 1 Else AgeAtSchemeEntry = Year(CDate(labelDateJOinedScheme.Text)) - Year(CDate(labelDOB.Text)) End If
1: 2: 3: 4:
dim JoinDate as Date = date.parse(labelDateJOinedScheme.Text) dim dateOfBirth as date = date.parse(labelDOB.Text) ageAtSchemeEntry = DateDiff(DateInterval.Year, dateofBirth, Joindate)