Click here to Skip to main content
15,503,367 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to cross check age if someone enters date of birth?
meaning 1st variable will be age and 2nd is dob

What I have tried:

I want to cross check age if someone enters date of birth?
meaning 1st variable will be age and 2nd is dob
if([age] <> [dob],1, 0)
Posted
Updated 23-Jun-21 9:11am

1 solution

The problem is that age is generally seen in terms of complete years, and subtracting dates gives you a timespan that isn't "fixed" to any point: you can't tell from that exactly how old a user is. And generally, if you are working with ages it's for a "legal reason" and you need to be precise: "almost 18" is not the same as "18 and a day".

This may help: Working with Age: it's not the same as a TimeSpan![^] - it's C# based not Javascript but it explains what it is doing and is pretty easy to follow anyway.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900