1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-16 02:47:36 +02:00
vcmi/lib/vstd/DateUtils.cpp
2023-08-23 01:47:55 +02:00

30 lines
552 B
C++

#include "StdInc.h"
#include <vstd/DateUtils.h>
VCMI_LIB_NAMESPACE_BEGIN
namespace vstd
{
DLL_LINKAGE std::string getFormattedDateTime(std::time_t dt)
{
std::tm tm = *std::localtime(&dt);
std::stringstream s;
s.imbue(std::locale(""));
s << std::put_time(&tm, "%x %X");
return s.str();
}
DLL_LINKAGE std::string getDateTimeISO8601Basic(std::time_t dt)
{
std::tm tm = *std::localtime(&dt);
std::stringstream s;
s.imbue(std::locale(""));
s << std::put_time(&tm, "%Y%m%dT%H%M%S");
return s.str();
}
}
VCMI_LIB_NAMESPACE_END