C++ Language/Std/CRuntime/Time/TimeAsString

To specify a date/time, set various data members of a std::tm object. Calling std::asctime() converts that information into a string of exactly 26 characters.

The computer's current time is obtained by std::time() as a std::time_t scalar value; std::localtime() converts that scalar value into std::tm.

Additional information about encoding time in a string value (includes interactive examples)