Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(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

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict