diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/stringutils.cpp | 14 | ||||
-rw-r--r-- | src/utils/stringutils.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 9184ba79d..2be1e5b77 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -609,3 +609,17 @@ bool strStartWith(std::string str1, std::string str2) return false; return str1.substr(0, str2.size()) == str2; } + +std::string getDateString() +{ + char buffer[80]; + + time_t rawtime; + struct tm *timeinfo; + + time (&rawtime); + timeinfo = localtime(&rawtime); + + strftime(buffer, 79, "%Y-%m-%d", timeinfo); + return std::string(buffer); +} diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index 47d495dd0..31ee6d51f 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -206,4 +206,6 @@ std::string &removeProtocol(std::string &url); bool strStartWith(std::string str, std::string start); +std::string getDateString(); + #endif // UTILS_STRINGUTILS_H |