#include <chrono>
#include <iomanip>
#include <iostream>
std::chrono::system_clock::time_point t = std::chrono::system_clock::now(); std::time_t c = std::chrono::system_clock::to_time_t(t); cout << std::put_time(std::localtime(&c), "%F %T\n"); // 2022-02-22 20:50:30