#includeIn this example, we create a CTime object representing the current system time using the `GetCurrentTime()` static method. We then use the `Format()` method to format the date and time as a string with the format string `"%Y-%m-%d %H:%M:%S"`. This format string specifies the year, month, day, hour, minute, and second in a specific order and with specific separators. Finally, we print the resulting string using the `printf()` function. CTime Format is part of the MFC library, which is included with Visual Studio. To use CTime Format in your own C++ application, you'll need to include the `afx.h` header file and link against the appropriate MFC libraries.void printCurrentDateTime() { // Get the current system time CTime currentTime = CTime::GetCurrentTime(); // Format the date and time string CString dateTimeString = currentTime.Format(_T("%Y-%m-%d %H:%M:%S")); // Print the string printf("%s\n", dateTimeString); }