#include <iostream>
#include <iomanip>
#include <sstream>
#include <ctime>
int main() {
// Get current time
std::time_t currentTime = std::time(nullptr);
// Convert time to tm structure
std::tm *timeStruct = std::localtime(¤tTime);
// Format the date and time
std::ostringstream oss;
oss << std::put_time(timeStruct, "%Y-%m-%d %H:%M:%S");
// Get the formatted date and time as a string
std::string formattedDateTime = oss.str();
// Print the formatted date and time
std::cout << "Formatted DateTime: " << formattedDateTime << std::endl;
return 0;
}