Here's a solution using standard C++; it uses the same approach as Christian's: split the input based on the dashes, pad missing digits with 0s:
#include <string>
#include <sstream>
#include <algorithm>
int main()
{
std::string date = "1992-9-12";
std::replace(date.begin(), date.end(), '-', ' '); // "1992 9 12"
std::istringstream iss(date);
int year = 0, month = 0, day = 0;
if (iss.good()) iss >> year; // 1992
if (iss.good()) iss >> month; // 9
if (iss.good()) iss >> day; // 12
std::ostringstream oss;
oss.fill('0');
oss.width(4); oss << year;
oss.width(2); oss << month;
oss.width(2); oss << day;
std::string convertedDate = oss.str(); // 19920912
}