-
getting current year
is there some way to do this with ctime?
I have included ctime, and I created a ctime variable for storing the current time, CTime theTime;
but I get an error "CTime undeclared identifier".
Also, is there anyway to seperate the year from the returned value?
Thank you!!
-
Where are you trying to use this??? Are you creating an MFC app? Or using MFC? Becuase CTime is a MFC class.
-
If you don't wanna use MFC, there is always this option...
Code:
struct tm * tmTime = NULL;
time_t tTimeInt = 0;
time( &tTimeInt );
tmTime = localtime( &tTimeInt );
tmTime->tm_year; // This is the current year
// minus 1900.