LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Still struggling with age calculator

Again, I am trying to calculate a person's age using 6 different numeric inputs.(current day, current month, current year, and Birth day, birth month, birth year). There is one output (age in years).  I tried using a select function where if current year>birth year, then subtract to get age in years...this works, but when i try to incorporate the days and months i run into problems.  any examples or suggestions on how to attempt this would be appreciated...thanks

0 Kudos
Message 1 of 3
(3,328 Views)

You can use the data you have to build a time rec cluster and then use the relevant function to convert the cluster to a timestamp. Subtract the older timestamp from the newer one and you will have the age in seconds. Divide that by the number of seconds in a year and you will have your answer. This doesn't take leap years, etc. into account, but since you want the age in years, I assume you don't care too much about accuracy at that level.


___________________
Try to take over the world!
0 Kudos
Message 2 of 3
(3,324 Views)

Please keep in original message thread.

0 Kudos
Message 3 of 3
(3,318 Views)