03-27-2013 10:42 PM
Given someone's Birth month day and year....and also the current month day and year...as inputs....calculate their age, in years...as output....age should not increment by one until their birthday arrives that year. I just cant get the coding right...please help
Solved! Go to Solution.
03-27-2013 11:44 PM
Show what you've done. What problem are you having?
03-27-2013 11:46 PM
What have you done so far? Show us what you tried and explain where it fails
What's "D4.1"?
The "Date/Time to Seconds" function will be helpful to you.
03-28-2013 09:02 AM
Subtract the birth year from the current year (four digit format) to get preliminary age. Then check the date (if current month/day is less than birth month/day, subtract 1 from age). should only require a few math steps and a case structure.
03-28-2013 09:06 AM
Just subtract the two date/timestamps. Then round down to the year.
03-28-2013 11:18 AM
@nathand wrote:
[...] What's "D4.1"? [...]
That's the number of the homework assignment.
03-28-2013 12:08 PM
thanks for your help...I'm new to lab view and am unfamiliar with a lot of the functions. I was using a select function. If the current year > the birth yr, then Current-birth. that worked. but as i try to connect the months and days into it , thats where my issues are coming up...I'm still not getting the outcome i want. Thanks
03-28-2013 12:55 PM - edited 03-28-2013 12:59 PM
Subtract the years from each other than subtract 1 to get age
Then
If current month is greater than birth month then
age=age+1
Elseif current month is equal to birth month AND current day is greater than equal to birthday then
age = age +1
Else
age is what you got in the first step.
end if.
03-28-2013 01:00 PM
is there an "if" sattement function?
03-28-2013 01:02 PM
It's called a Case Structure. It has an input terminal which you can wire. one piece of code inside the structure runs base on the value wired to the input terminal.