You remember the days when it was necessary to use strftime to convert time to human readable strings? Even in C++ it actually was a pain in the ass.
This is the way how you can do in in C++11:
#include <iostream> #include <iomanip> #include <ctime> int main() { auto t = std::time(nullptr); auto tm = *std::localtime(&t); std::cout << std::put_time(&tm, "%d-%m-%Y %H-%M-%S") << std::endl; }
Hell yeah, I love C++11!