Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC
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 Frown | :(
 

Greetings
Epanjohura
Posted 23-Nov-12 4:27am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

CTime::GetDay()[^]. What part of that are you having difficulty with?
  Permalink  
Comments
epanjohura at 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 at 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 at 26-Nov-12 4:36am
   
because it's the same link I saw before asking this question...
Richard MacCutchan at 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 at 26-Nov-12 5:25am
   
well I tryed really hard and now it works. But how do I get the next date?
Richard MacCutchan at 26-Nov-12 6:03am
   
What do you mean "next date"? Please try and explain clearly what you are trying to do. If possible show some of your code and indicate which part is not working.
epanjohura at 26-Nov-12 6:12am
   
Okay I'll explane, I mean: I want to get the current date (Example: variable CurrDate = "2012/11/26"; variable Date_1 = "2012/11/27"; Date_2 = "2012/11/28"; Date_3 = "2012/11/29" and so on... until Date_7 is definied.
 
Do you know what I mean now?
Richard MacCutchan at 26-Nov-12 6:31am
   
See my next answer
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Something like ...
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
  Permalink  
Comments
epanjohura at 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)



Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 26 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid