c++ unix time to string
#include <chrono>
#include <iomanip>
#include "bits/stdc++.h"
using namespace std;
using namespace chrono;
std::uint32_t time_date_stamp = 1484693089;
std::time_t temp = time_date_stamp;
std::tm* t = std::gmtime(&temp);
std::stringstream ss; // or if you're going to print, just input directly into the output stream
ss << std::put_time(t, "%Y-%m-%d %I:%M:%S %p");
std::string output = ss.str();
本文链接地址:https://const.net.cn/641.html