Getting someone's age from dob and current year

Admin admin at mfelkerco.com
Sat Jul 30 20:31:31 EDT 2011


  

Thank you. I am sure that will do it! 

Mike 

On Sat, 30 Jul 2011
20:16:44 -0400, Roger Eller wrote: 

> On Sat, Jul 30, 2011 at 5:20 PM,
Admin wrote:
> 
>> Hello all, I need to figure out someone's age. I have
their date of birth and I have today's date. How do I get the end
result. My math skills SUCK. Here's my code (loaded in from the database
with a SELECT statement): put item 7 of myLine into dobMonth put item 8
of myLine into dobDay put item 9 of myLine into dobYear put
chartonum("dobYear") into dobYearNum put the long system date into field
"TodayDate" I figured I would subtract this year from the dobyear and
get the age - am I right? How would I do this if I am? Mike
> 
> Hey
Mike, put this into a new button object.
> 
> on mouseUp
> put the date
into tToday
> ask "Enter the date of birth as dd/mm/yy"
> put it into
tBorn
> convert tToday to seconds
> convert tBorn to seconds
> put
(tToday - tBorn) into tAge -- in seconds
> -- now do the math in tAge
>
-- to determine how many years that is
> answer "The age is" && tAge &&
"seconds old." & cr & cr 
> & "You didn't expect me to do all of the
math, now did you? :)"
> end mouseUp
> 
> ˜Roger
>
_______________________________________________
> use-livecode mailing
list
> use-livecode at lists.runrev.com [1]
> Please visit this url to
subscribe, unsubscribe and manage your subscription preferences:
>
http://lists.runrev.com/mailman/listinfo/use-livecode [2]

 


Links:
------
[1] mailto:use-livecode at lists.runrev.com
[2]
http://lists.runrev.com/mailman/listinfo/use-livecode



More information about the use-livecode mailing list