what if i want to find out the age or period laps between certain dates for a database of 200 persons.

for example:

1- aaaa dob: 12-12-1983
2- bbbb dob: 01-04-1980


i want to get out put as
aaaa's age on 01-01-2012 is xx day, xx months xx years

and so on .

You need to first get the current date from the computer's clock. Use the functions in time.h, time() returns the date/time in seconds, then call localtime() to covert that into a struct tm. Next convert user's birth date into month, day and year integers, then just subtract from struct tm. It's not a straight forward subtraction, so you might want to do it a couple times by hand using pencil & paper in order to get the algorithm straight in your mind.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.