Here is the working code
string s{"2019-08-22T10:55:23.000Z"}; std::tm t{}; std::istringstream ss(s); ss >> std::get_time(&t, "%Y-%m-%dT%H:%M:%S"); if (ss.fail()) { throw std::runtime_error{"failed to parse time string"}; } std::time_t time_stamp = mktime(&t);
source share