diff options
Diffstat (limited to 'src/Format.h')
| -rw-r--r-- | src/Format.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Format.h b/src/Format.h new file mode 100644 index 0000000..1df883f --- /dev/null +++ b/src/Format.h @@ -0,0 +1,23 @@ +#pragma once + +#include <sstream> + +namespace format +{ + template <typename T> std::string NumberToString(T number) + { + std::stringstream ss; + ss << number; + return ss.str(); + } + + template <typename T> T StringToNumber(const std::string & text) + { + std::stringstream ss(text); + T number; + return (ss >> number)?number:0; + } + + std::string UnixtimeToDate(time_t unixtime, std::string dateFomat = "%d %b %Y"); + std::string UnixtimeToDateMini(time_t unixtime); +}
\ No newline at end of file |
