#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define MAX_LENGTH 20
int main() {
char dateSeries[MAX_LENGTH][20] = {
"2023-01-01", "2023-02-15", "2023-03-30",
"2023-04-10", "2023-05-22", "2023-06-05"
};
for (int i = 0; i < MAX_LENGTH; i++) {
struct tm tm_date;
memset(&tm_date, 0, sizeof(struct tm));
sscanf(dateSeries[i], "%d-%d-%d",
&tm_date.tm_year, &tm_date.tm_mon, &tm_date.tm_mday);
tm_date.tm_year -= 1900;
tm_date.tm_mon--;
time_t timestamp = mktime(&tm_date);
printf("Original: %s, Converted: %s", dateSeries[i], ctime(×tamp));
}
return 0;
}