C++ Tutorial - Misc.

bogotobogo.com site search:
time
#include <ctime> #include <iostream> using namespace std; int main() { time_t current = time(0); cout << "Second from epoc = " << current << endl; tm *local_tm = localtime(¤t;); cout << "Year: " << 1900 + local_tm->tm_year << endl; cout << "Mothe: " << 1 + local_tm->tm_mon << endl; cout << "Day: " << local_tm->tm_mday << endl; cout << "Time: " << 1 + local_tm->tm_hour << ":"; cout << 1 + local_tm->tm_min << ":"; cout << 1 + local_tm->tm_sec << endl; }
Output is:
Second from epoc = 1360456610 Year: 2013 Mothe: 2 Day: 9 Time: 17:37:51
Full List of C++ Tutorials
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization

Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization