CTime myTime(2021, 10, 15, 0, 0, 0); // create a CTime object for October 15, 2021 int day = myTime.GetDay(); // get the day of the month (15)
CTime now = CTime::GetCurrentTime(); // get the current date and time int day = now.GetDay(); // get the day of the month from the current date/time
CTimeSpan duration(7, 0, 0, 0); // create a CTimeSpan object for 7 days CTime start(2021, 11, 1, 0, 0, 0); // create a CTime object for Nov 1, 2021 CTime end = start + duration; // add the duration to start to get the end date int endDay = end.GetDay(); // get the day of the month for the end dateIn these examples, we are using the CTime class and its GetDay() member function to retrieve the day of the month from different CTime objects. The package library for CTime is MFC (Microsoft Foundation Class).