I need to compare two dates. The current date with the user input one in the format dd/mm/yyyy.
So if expiry_date > current_date
display.... I have tried difftime() but that didnt work well since it uses a time parameter
time_t now; struct tm newyear; double seconds; time(&now); /* get current time; same as: now = time(NULL) */ newyear = *localtime(&now); newyear.tm_hour = 0; newyear.tm_min = 0; newyear.tm_sec = 0; newyear.tm_mon = 0; newyear.tm_mday = 1; seconds = difftime(now,mktime(&newyear)); printf ("%.f seconds diff", seconds); system("pause");
heres a sample code i found