diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-04 12:40:39 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-04 12:40:39 (GMT) |
| commit | 268795eec167a5fdeadef86dabbedac258e5b20a (patch) | |
| tree | b0c2e8c06ba8454c6191bd87066cb7bb19a6fbe2 /src/Format.h | |
| parent | ab8466e9908d3982d498b63197bb80ffb489f3c1 (diff) | |
| download | powder-268795eec167a5fdeadef86dabbedac258e5b20a.zip powder-268795eec167a5fdeadef86dabbedac258e5b20a.tar.gz | |
Add date to Preview View, fixes issue #64
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 |
