I use following code
<code>#include <iomanip>
#include <iostream>
#include <locale>
#include <sstream>
int main() {
std::tm t = {};
std::istringstream ss("2011-Februar-18 23:12:34");
ss.imbue(std::locale("de_DE.utf-8"));
ss >> std::get_time(&t, "%Y-%b-%d %H:%M:%S");
if (ss.fail())
std::cout << "Parse failedn";
else
std::cout << std::put_time(&t, "%c") << 'n';
}
</code>
<code>#include <iomanip>
#include <iostream>
#include <locale>
#include <sstream>
int main() {
std::tm t = {};
std::istringstream ss("2011-Februar-18 23:12:34");
ss.imbue(std::locale("de_DE.utf-8"));
ss >> std::get_time(&t, "%Y-%b-%d %H:%M:%S");
if (ss.fail())
std::cout << "Parse failedn";
else
std::cout << std::put_time(&t, "%c") << 'n';
}
</code>
#include <iomanip>
#include <iostream>
#include <locale>
#include <sstream>
int main() {
std::tm t = {};
std::istringstream ss("2011-Februar-18 23:12:34");
ss.imbue(std::locale("de_DE.utf-8"));
ss >> std::get_time(&t, "%Y-%b-%d %H:%M:%S");
if (ss.fail())
std::cout << "Parse failedn";
else
std::cout << std::put_time(&t, "%c") << 'n';
}
in “>>” it throw err:
<code>In template: reference to non-static member function must be called error occurred here in instantiation of member function 'std::time_get<char>::get' requested here in instantiation of function template specialization 'std::operator>><char, std::char_traits<char>>' requested here
</code>
<code>In template: reference to non-static member function must be called error occurred here in instantiation of member function 'std::time_get<char>::get' requested here in instantiation of function template specialization 'std::operator>><char, std::char_traits<char>>' requested here
</code>
In template: reference to non-static member function must be called error occurred here in instantiation of member function 'std::time_get<char>::get' requested here in instantiation of function template specialization 'std::operator>><char, std::char_traits<char>>' requested here