Is there any better way of getting the system date values and storing them than this? The values have got to be stored as type int for the work i'll be doing.
Code:
#include <iostream.h>
#include <time.h>
int main()
{
const int DATE_LEN=5;
int Day, Month, Year;
static char Date[DATE_LEN];
time_t SystemDate;
SystemDate = time(NULL);
strftime(Date, sizeof(Date), "%d", localtime(&SystemDate));
Day = atoi(Date);
strftime(Date, sizeof(Date), "%m", localtime(&SystemDate));
Month = atoi(Date);
strftime(Date, sizeof(Date), "%Y", localtime(&SystemDate));
Year = atoi(Date);
cout << "The date is: Day " << Day << " Month " << Month << " Year " << Year;
cin.get();
return 0;
}