First, get year, month and day out of your string:
char my_date="10131520";
int my_date_n=atoi(my_date); // or any better method
int month = (my_date_n/1000000)%100;
int day = (my_date_n/ 10000)%100;
int year = (my_date_n/ 1)%10000;
(There's a lot of ways of doing this. This might not be the best.)
Then, normally for far away dates you would use julian days:
https://en.wikipedia.org/wiki/Julian_day#Converting_Julian_or_Gregorian_calendar_date_to_Julian_Day_Number
for instance:
double calc_jd(int y, int mo, int d,
int h, int mi, float s)
{
// variant using ints
int A=(14-mo)/12;
int Y=y+4800-A;
int M=mo+12*A-3;
int JD=d + ((153*M+2)/5) + 365*Y + (Y/4) - (Y/100) + (Y/400) - 32045;
// add time of day at this stage
return JD + (h-12)/24.0 + mi/1440.0 + s*(1.0/86400.0);
}
Then you convert this one to unix time, which is the inverse of the answer in this question:
Convert unix timestamp to julian
double unix_time_from_jd(double jd)
{
return (jd-2440587.5)*86400.0;
}
so
double jd = calc_jd(year,month,day,12,0,0); // time of day, timezone?
double unix_time = unix_time_from_jd(jd);
note that you might get way outside any range that you can use with
the normal tools that uses this kind of date if we're talking about
the year 1520. (That's why I keep using a double here.)