I need to find the current date and use it in a function, not display it. Everything I found so far just displays the current date and will not let me use it to do my calculation. If I can find out the current year, month, and day separately would also work.
My function needs to find a person’s age from the input of their date of birth. The input and output has to be in the integer format.
Example of input data: (12052010) format- “mmddyyyy”
I already have it broken down into: 12 , 05, 2010 separately so I can do the math to find out their age.
I’m using Microsoft Developer Studio - Visual C++ 5.0
Any help will be appreciated, thanks
Not sure it will help, but here is some of the code I'm working with.
int studentDateOfBirth = 02151971; //(student input)
int month;
int day;
int year;
// Function to print the student’s date of birth with dashes.
void studentInformation::getPatientDateOfBirth( )
{
month = studentDateOfBirth / 1000000;
day = (studentDateOfBirth % 1000000) / 10000;
year = studentDateOfBirth % 10000;