Here is example how I do that in Linux, but in Windows I don't have strptime
function anyone can help me solve this problem?
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
time_t to_seconds(const char *date)
{
struct tm storage = {0, 0, 0, 0, 0, 0, 0, 0, 0};
char *p = NULL;
time_t retval = 0;
p = (char *) strptime(date, "%d-%b-%Y", &storage);
if (p == NULL)
{
retval = 0;
}
else
{
retval = mktime(&storage);
}
return retval;
}
int main(int argc, char** argv)
{
time_t d1 = to_seconds("16-Jun-2015");
time_t d2 = to_seconds("13-Jun-2015");
if(d1 > d2)
{
printf("date 1 > date 2");
}
}