Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

birthdate

Status
Not open for further replies.

suzmcc

Programmer
Oct 10, 2000
2
US
Need to find out how to calculate the age of a person. I need to produce documents for those persons who are 6 and older not under 6. That is 6 as of the month of production of the letters not 6 as of the first of the year, 6 as of their respective birthdate. [sig][/sig]
 
So you have their birthdate right? Well then all you have to do is use the function DaysAfter. It looks like this

DaysAfter ( date1, date2 )

where date1 is the persons birthdate and date2 is today's date. That will return you the amount of days since the specific persons birthday. Then all that is left to do is divide that number by 365 which will give you the persons age. If you want to get really technical you will have to check for leap years but otherwise that should be fine and then just do a check where the total is greater than 6. So even if the total is 6.1 the check will pick it up. Hope this helps maybe checkout PowerBuilders help file about DaysAfter and use the see also feature if this doesn't help you.

Regards

Tentacle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top