Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Calendar Week Problem

Calendar Week Problem

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sonu Kapoor
    wrote on last edited by
    #1

    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

    W 1 Reply Last reply
    0
    • S Sonu Kapoor

      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

      W Offline
      W Offline
      wangyiming
      wrote on last edited by
      #2

      COleDateTime curDate = COleDateTime::GetCurrentTime(); int weekDay = curDate.GetDayOfWeek();

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups