Are there any functions that return the current day month and year as integer.
Are there any functions that return the current day month and year as integer.
OS? Compiler?
-Govtcheez
[email protected]
Have a look at the ctime functions here.
Note: for tm_mon, jan = 0, feb = 1, ..., dec = 11
Code:#include <iostream> #include <ctime> int main( void ) { tm * curTM; time_t temp = time( NULL ); curTM = localtime( &temp ); std::cout<<"Day: "<<curTM->tm_mday<<" Month: "<<curTM->tm_mon<<" Year: "<<curTM->tm_year + 1900<<std::endl; return 0; }
Last edited by XSquared; 03-18-2003 at 02:03 PM.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
GetSystemTime() on windows is pretty good and easy. but then you still haven't said what platform you're on
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
Thx allot, XSquared. Works perfectly.
I was trying to mess around with time.h, but that
didn't lead anywhere. You just saved me about 2 hours of programming.