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. CMonthCalCtrl returns wrong date

CMonthCalCtrl returns wrong date

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorial
2 Posts 1 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.
  • A Offline
    A Offline
    asierra
    wrote on last edited by
    #1

    Hello all, I created a Month calendar control into my form, and I want to use it as a date picker, so when the user selects a date, I will fill other CEdit controls with the date selected. But I realize that within MCN_SELECT, the value associated with my Calendar Control, gets the wrong date. void CPlanmView::OnSelectMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult) { // Users Selects a Date, so MCN_SELECT triggers this. // User selected October 31, 2003 but returns // Feb,10,2004 *pResult = 0; UpdateData(); m_DayPlm.Format("%d",m_CalendarVal.GetDay()); m_MonthPlm.Format("%d",m_CalendarVal.GetMonth()); m_YearPlm.Format("%d",m_CalendarVal.GetYear()); UpdateData(FALSE); } I have also seen the sample provided in the msdn, and it has the same problem, for this control. Any Ideas on how to workaround this issue. Best, -Alfredo

    A 1 Reply Last reply
    0
    • A asierra

      Hello all, I created a Month calendar control into my form, and I want to use it as a date picker, so when the user selects a date, I will fill other CEdit controls with the date selected. But I realize that within MCN_SELECT, the value associated with my Calendar Control, gets the wrong date. void CPlanmView::OnSelectMonthcalendar1(NMHDR* pNMHDR, LRESULT* pResult) { // Users Selects a Date, so MCN_SELECT triggers this. // User selected October 31, 2003 but returns // Feb,10,2004 *pResult = 0; UpdateData(); m_DayPlm.Format("%d",m_CalendarVal.GetDay()); m_MonthPlm.Format("%d",m_CalendarVal.GetMonth()); m_YearPlm.Format("%d",m_CalendarVal.GetYear()); UpdateData(FALSE); } I have also seen the sample provided in the msdn, and it has the same problem, for this control. Any Ideas on how to workaround this issue. Best, -Alfredo

      A Offline
      A Offline
      asierra
      wrote on last edited by
      #2

      I just found the answer for this problem Microsoft Knowledge Base Article - 235355 I post it here for reference in case somebody else has to deal with this. The Microsoft article says this behaviour is by design, and SYSTEMTIME should be used instead of CTime class Best, Alfredo

      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