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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to count age in dbase

Status
Not open for further replies.

stv2005

Programmer
Jan 25, 2006
3
MY
This is my first dbase related assignment. i need to count age by refering to today's date & date of birth of the person. I have a hard time to even call today's date function in dbase. Anyone pls help!!
 
i figured out how to get today's date... it's date(). But still stuck in the conversion. Pls help... Thank you in advance.
 
i've figured it out... yahoo!!
I'm actually counting age in month for babies. the following code is what wrote:
.replace age with (month(date())+(12*year(date())))-(month(childdob)+(12*year(childdob))) for day(date())>=day(childdob)
.replace age with (month(date())+(12*year(date())-1)-(month(childdob)+12*year(childdob)) for day(date())<day(childdob)

anyone can help me to test whether this set of code have any bug? hopefully it's correct, i'm going to test it right away.
 
Can your version process the IIF() function? If so then you can combine it into one command rather than 2. Harder to read with all those parantheses, but more compact.

Code:
replace age with (month(date())+(12*year(date())-IIF(day(date())<day(childdob),1,0))-(month(childdob)+12*year(childdob))
dbMark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top