fork(10) download
  1. #include <chrono>
  2. #include <ctime>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. typedef std::chrono::system_clock Clock;
  8.  
  9. int main()
  10. {
  11. auto now = Clock::now();
  12. std::time_t now_c = Clock::to_time_t(now);
  13. struct tm *parts = std::localtime(&now_c);
  14.  
  15. std::cout << 1900 + parts->tm_year << std::endl;
  16. std::cout << 1 + parts->tm_mon << std::endl;
  17. std::cout << parts->tm_mday << std::endl;
  18.  
  19. return 0;
  20. }
  21.  
Success #stdin #stdout 0s 2960KB
stdin
Standard input is empty
stdout
2011
12
1