I have dates as strings in this format:
YYYY-MM-DD (2021-07-01, 2021-02-21 etc.)
Now I want to compare them, and the best solution I can think of is converting all of those dates into some number (like unix time), but I don't know how to do it.
It has to be precise with days (so that 2021-01-01 < 2021-01-02).
I found strptime() function on the Internet, but I'm a Windows user (CLion), so I can't use that.
Is it possible to do it in a simple way? Leap years have to accounted for.
EDIT: My input data look like this:
char date1[] = "2021-01-07";
char date2[] = "2021-01-14";
char date3[] = "2021-01-20"; etc.
How I want to use them:
if (date1 < date2 < date3){
// return "true" if date2 is in the interval (Pseudocode ofc)
return true;
}