(C++) std::localtime
January 10, 2018 · View on GitHub
(C++) std::localtime
std::localtime is an STL time function to obtain the local date and time.
Example: GetToday
#include <ctime> #include <iostream> int main () { std::time_t my_time; std::time( &my_time ); const std::tm * const time_and_date = std::localtime(&my_time); std::cout << std::asctime(time_and_date); }
Today's screen output:
Sun Aug 8 09:01:41 2010