COleDateTime dt(2022, 8, 25, 0, 0, 0); // Creating a COleDateTime object for 25th August, 2022 int day = dt.GetDay(); // Getting the day of the month using GetDay() function // day will be 25
COleDateTime dt = COleDateTime::GetCurrentTime(); // Getting the current date and time int day = dt.GetDay(); // Getting the day of the current month using GetDay() function // day will be the current day of the monthIn this example, we use the GetCurrentTime() function to get the current date and time and then use GetDay() function to retrieve the day of the current month. Package/Library: MFC (Microsoft Foundation Classes) library.