Don't you use the scanf function when you're making a calendar program and you want to enter a range?
If you enter a range like 2021.05.24-2021.08.09, you want to print out a calendar suitable for the month.
If you want to convert the "2021.05.24-2021.08.09" form to date, please refer to the code below
It is more convenient to receive each value through scanf and convert it to strptime after receiving it throughout the string.
Of course, since the type of input contains two dates, it would be better to split it into two based on the letter ' -', right?
void main ()
struct tm t;
const char* date = (2019-10-21"; // date string: October 21, 2019
const char* time = "18:16:24"; // time string: 18:16:24
ret = strptime(date, "%Y-%m-%d", &t); // date string to tm structure
ret = strptime(time, "%H:%M:%S", &t); // time string to tm structure
strftime(buf, sizeof(buf), "%Y year %m month %d", &t); // tm structure to buf the date
strftime(buf, sizeof(buf), "%H:%M:%S", &t); // time in tm structure to buff