fork download
  1. #include <vector>
  2. #include <string>
  3. #include <iostream>
  4. #include <ctime>
  5.  
  6. int main()
  7. {
  8. char buff[20];
  9. time_t timestamp = 1469870826;
  10. std::strftime(buff, sizeof(buff), "%Y:%m:%d %H:%M:%S", std::localtime(&timestamp));
  11. std::string timeStr(buff);
  12.  
  13. std::cout << "time = " << timestamp << " | " << timeStr << std::endl;
  14. }
  15.  
Success #stdin #stdout 0s 16064KB
stdin
Standard input is empty
stdout
time = 1469870826 | 2016:07:30 09:27:06