Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- const boost::gregorian::date DATE_EPOCH(1970, 1, 1);
- const boost::posix_time::ptime PTIME_DATE_EPOCH(DATE_EPOCH);
- uint64_t time = 1552575540001; // 14 Mar 2019 14:59:00.001
- using namespace boost::posix_time;
- const ptime posixTime = ptime(PTIME_DATE_EPOCH.date(), milliseconds(time));
- const std::string mask= "%Y-%m-%dT%H:%M:%SZ";
- std::ostringstream stream;
- stream.imbue(std::locale(stream.getloc(), new time_facet(mask.c_str())));
- stream << posixTime;
- std::string timeStr = stream.str();
- std::cout << timeStr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement