Click here to Skip to main content
15,868,340 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys

How do I use CTime::GetDay() in MFC and how do I initialize a variable with the content of "GetDay()"?


I need your help :(


Greetings
Epanjohura
Posted

CTime::GetDay()[^]. What part of that are you having difficulty with?
 
Share this answer
 
Comments
epanjohura 26-Nov-12 3:06am    
I want to get the current day... example: today, "11/26/2012". This date should be saved in a variable..
Richard MacCutchan 26-Nov-12 4:02am    
Firstly that is not the day, it's the date. Secondly why don't you read the documentation (from the link I gave you) and try a bit of experimentation?
epanjohura 26-Nov-12 4:36am    
because it's the same link I saw before asking this question...
Richard MacCutchan 26-Nov-12 5:01am    
Well, if you look at all the documentation for this class it shows you how to get the complete date, or the individual fields. You can then use them to do whatever it is you want.
epanjohura 26-Nov-12 5:25am    
well I tryed really hard and now it works. But how do I get the next date?
Something like ...
C++
CTime dtArray[7];
dtArray[0] = CTime::GetCurrentTime();
CTimeSpan tsDay = new CTimeSpan(1, 0, 0, 0);
for (int dayx = 1; dayx < 7; ++dayx)
{
    dtArray[dayx] = dtArray[dayx - 1] + tsDay;
}
// dtArray now contains 7 successive dates from today
 
Share this answer
 
Comments
epanjohura 26-Nov-12 6:38am    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900