Calendar Week Problem
-
Hi Guys, i am using the following code to calculate the Calendar Week, using Month Calendar Control (m_cal1). in the heade file... COleDateTime ActualWeek1; COleDateTimeSpan Weekdiff1; in the function OnSelchangeMonthcalendar1.... SYSTEMTIME sysTime; m_cal1.GetCurSel(&sysTime); ActualWeek1.SetDate(sysTime.wYear, sysTime.wMonth, sysTime.wDay); COleDateTime ActualTempWeek1( sysTime.wYear, sysTime.wMonth, 0, 0, 0, 0 ); Weekdiff1 = ActualWeek1 - ActualTempWeek1; week1 = Weekdiff1.GetDays()/7+1; CString week; week.Format("%d",week1); AfxmessageBox(week); If i use this code in my function OnSelchangeMonthcalendar1 and select a date, it always starts the week from wednesday and according to this it displays the wrong week. So how can i get the correct calendar week ?? Best Regards Sonu
-
Hi Guys, i am using the following code to calculate the Calendar Week, using Month Calendar Control (m_cal1). in the heade file... COleDateTime ActualWeek1; COleDateTimeSpan Weekdiff1; in the function OnSelchangeMonthcalendar1.... SYSTEMTIME sysTime; m_cal1.GetCurSel(&sysTime); ActualWeek1.SetDate(sysTime.wYear, sysTime.wMonth, sysTime.wDay); COleDateTime ActualTempWeek1( sysTime.wYear, sysTime.wMonth, 0, 0, 0, 0 ); Weekdiff1 = ActualWeek1 - ActualTempWeek1; week1 = Weekdiff1.GetDays()/7+1; CString week; week.Format("%d",week1); AfxmessageBox(week); If i use this code in my function OnSelchangeMonthcalendar1 and select a date, it always starts the week from wednesday and according to this it displays the wrong week. So how can i get the correct calendar week ?? Best Regards Sonu
COleDateTime curDate = COleDateTime::GetCurrentTime(); int weekDay = curDate.GetDayOfWeek();