DateUtils.cpp 330 B

1234567891011121314151617181920
  1. #include "StdInc.h"
  2. #include <vstd/DateUtils.h>
  3. VCMI_LIB_NAMESPACE_BEGIN
  4. namespace vstd
  5. {
  6. DLL_LINKAGE std::string getFormattedDateTime(std::time_t dt)
  7. {
  8. std::tm tm = *std::localtime(&dt);
  9. std::stringstream s;
  10. s.imbue(std::locale(""));
  11. s << std::put_time(&tm, "%x %X");
  12. return s.str();
  13. }
  14. }
  15. VCMI_LIB_NAMESPACE_END