diff --git a/cmake_modules/VCMI_lib.cmake b/cmake_modules/VCMI_lib.cmake
index 7152a5327..ba34a1391 100644
--- a/cmake_modules/VCMI_lib.cmake
+++ b/cmake_modules/VCMI_lib.cmake
@@ -220,6 +220,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/spells/effects/RemoveObstacle.cpp
${MAIN_LIB_DIR}/spells/effects/Sacrifice.cpp
+ ${MAIN_LIB_DIR}/vstd/DateUtils.cpp
${MAIN_LIB_DIR}/vstd/StringUtils.cpp
${MAIN_LIB_DIR}/ArtifactUtils.cpp
@@ -283,6 +284,7 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE)
${MAIN_LIB_DIR}/../include/vstd/ContainerUtils.h
${MAIN_LIB_DIR}/../include/vstd/RNG.h
+ ${MAIN_LIB_DIR}/../include/vstd/DateUtils.h
${MAIN_LIB_DIR}/../include/vstd/StringUtils.h
${MAIN_LIB_DIR}/../include/vcmi/events/AdventureEvents.h
diff --git a/include/vstd/DateUtils.h b/include/vstd/DateUtils.h
new file mode 100644
index 000000000..9f3a9cc43
--- /dev/null
+++ b/include/vstd/DateUtils.h
@@ -0,0 +1,12 @@
+#pragma once
+
+VCMI_LIB_NAMESPACE_BEGIN
+
+namespace vstd
+{
+
+ DLL_LINKAGE std::string getFormattedDateTime(std::time_t dt);
+
+}
+
+VCMI_LIB_NAMESPACE_END
diff --git a/lib/VCMI_lib.vcxproj b/lib/VCMI_lib.vcxproj
index 2598a5bc6..ea6777a05 100644
--- a/lib/VCMI_lib.vcxproj
+++ b/lib/VCMI_lib.vcxproj
@@ -320,6 +320,7 @@
+
diff --git a/lib/VCMI_lib.vcxproj.filters b/lib/VCMI_lib.vcxproj.filters
index a8541fe9d..3679e6a8c 100644
--- a/lib/VCMI_lib.vcxproj.filters
+++ b/lib/VCMI_lib.vcxproj.filters
@@ -393,6 +393,9 @@
registerTypes
+
+ vstd
+
vstd
diff --git a/lib/mapping/CMapInfo.cpp b/lib/mapping/CMapInfo.cpp
index cc70ab059..64796bb6f 100644
--- a/lib/mapping/CMapInfo.cpp
+++ b/lib/mapping/CMapInfo.cpp
@@ -10,6 +10,8 @@
#include "StdInc.h"
#include "CMapInfo.h"
+#include
+
#include "../filesystem/ResourceID.h"
#include "../StartInfo.h"
#include "../GameConstants.h"
@@ -62,12 +64,7 @@ void CMapInfo::saveInit(const ResourceID & file)
fullFileURI = boost::filesystem::canonical(*CResourceHandler::get()->getResourceName(file)).string();
countPlayers();
std::time_t time = boost::filesystem::last_write_time(*CResourceHandler::get()->getResourceName(file));
-
- std::tm tm = *std::localtime(&time);
- std::stringstream s;
- s.imbue(std::locale(""));
- s << std::put_time(&tm, "%x %X");
- date = s.str();
+ date = vstd::getFormattedDateTime(time);
// We absolutely not need this data for lobby and server will read it from save
// FIXME: actually we don't want them in CMapHeader!
diff --git a/lib/vstd/DateUtils.cpp b/lib/vstd/DateUtils.cpp
new file mode 100644
index 000000000..41f2d59c7
--- /dev/null
+++ b/lib/vstd/DateUtils.cpp
@@ -0,0 +1,20 @@
+#include "StdInc.h"
+#include
+
+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();
+ }
+
+}
+
+VCMI_LIB_NAMESPACE_END