#include #include #include #include boost::gregorian::date testDate = boost::gregorian::day_clock::local_day();//(client.dateOfBirth); boost::gregorian::date_facet *format = new boost::gregorian::date_facet("%Y-%m-%d"); std::ostringstream output1; std::wostringstream output2; int main(int argc, char **argv){ output1.imbue(std::locale(std::locale(),format)); output1 << testDate; output2.imbue(std::locale(std::locale(),format)); output2 << testDate; std::cout << "date: " << output1.str() << std::endl; std::wcout << L"date: " << output2.str() << std::endl; std::cout.imbue(std::locale(std::locale(),format)); std::cout << "date: " << testDate << std::endl; std::wcout.imbue(std::locale(std::locale(),format)); std::wcout << L"date: " << testDate << std::endl; } /** Output: * * date: 2013-09-19 * date: 2013-Sep-19 * date: 2013-09-19 * date: 2013-Sep-19 * */