-
Date/Time confusion?
Hi,
Need som help with a Date/Time problem.
I've read page up and page down about different ways to determine the date and time in a function. But I get very confused because which way should I use? Which one can you recommand for me to use?
I need to determine the time and date. So I can write it to a file with some other stuff i need to remember.
The file creation and inputting is no problem though. :)
Thx in advance.
-
Here's a simple example.
Code:
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
time_t now = time(NULL);
tm *t = localtime(&now);
cout << t->tm_mon+1 << endl;
cout << t->tm_mday << endl;
cout << t->tm_year+1900 << endl;
cout << t->tm_hour << endl;
cout << t->tm_min << endl;
cout << t->tm_sec << endl;
return 0;
}
-
What's the return type? Int?