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. Date Time Picker

Date Time Picker

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
8 Posts 3 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.
  • D Offline
    D Offline
    Drawil
    wrote on last edited by
    #1

    hi I used the datetimepicker control and I added a member variable for this control, but when i use UpdateData(); the problem occured with any date befor 1969-12-31. is it a bug in vc6? can I use this control for date before 1969-12-31 and how? Best Regards :)

    L 1 Reply Last reply
    0
    • D Drawil

      hi I used the datetimepicker control and I added a member variable for this control, but when i use UpdateData(); the problem occured with any date befor 1969-12-31. is it a bug in vc6? can I use this control for date before 1969-12-31 and how? Best Regards :)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      I use this control without any problems. Even the year 1817 is reachable. Your accompanying code must be teh problem. Geert.

      D 1 Reply Last reply
      0
      • L Lost User

        I use this control without any problems. Even the year 1817 is reachable. Your accompanying code must be teh problem. Geert.

        D Offline
        D Offline
        Drawil
        wrote on last edited by
        #3

        thanx allways i got the following message: (Debug Assertion failed! program : file.exe timecor.cpp line:40) this file (timecore.cpp)is done with vc6 Best Regards :)

        L 1 Reply Last reply
        0
        • D Drawil

          thanx allways i got the following message: (Debug Assertion failed! program : file.exe timecor.cpp line:40) this file (timecore.cpp)is done with vc6 Best Regards :)

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          So, what's on line 40 of timecor.cpp?

          D 1 Reply Last reply
          0
          • L Lost User

            So, what's on line 40 of timecor.cpp?

            D Offline
            D Offline
            Drawil
            wrote on last edited by
            #5

            ASSERT(m_time != -1); // indicates an illegal input time Best Regards :)

            D 1 Reply Last reply
            0
            • D Drawil

              ASSERT(m_time != -1); // indicates an illegal input time Best Regards :)

              D Offline
              D Offline
              Derek Waters
              wrote on last edited by
              #6

              Hi, Your problem is that the MFC CTime class actually uses the mktime() call internally. If you look at the definition of mktime() you'll see that it uses a time_t, which is a floating point value representing the number of seconds since, you guessed it, Jan 1 1970. The problem here is the fact that you're mapping your control to a CTime value. Open the ClassWizard and delete the mapped variable. Add it again, but make sure you select COleDateTime from the Variable Type combo. This should give you a much larger range of values. Hope this helps. ------------------------ Derek Waters derek@lj-oz.com

              D 1 Reply Last reply
              0
              • D Derek Waters

                Hi, Your problem is that the MFC CTime class actually uses the mktime() call internally. If you look at the definition of mktime() you'll see that it uses a time_t, which is a floating point value representing the number of seconds since, you guessed it, Jan 1 1970. The problem here is the fact that you're mapping your control to a CTime value. Open the ClassWizard and delete the mapped variable. Add it again, but make sure you select COleDateTime from the Variable Type combo. This should give you a much larger range of values. Hope this helps. ------------------------ Derek Waters derek@lj-oz.com

                D Offline
                D Offline
                Drawil
                wrote on last edited by
                #7

                thanx it is working now, does it work with date field of a access db? Best Regards :)

                D 1 Reply Last reply
                0
                • D Drawil

                  thanx it is working now, does it work with date field of a access db? Best Regards :)

                  D Offline
                  D Offline
                  Derek Waters
                  wrote on last edited by
                  #8

                  Well, assuming that you're using some COM-based technology to access your Access DB (and I would imagine it'd be pretty tough otherwise!) then COleDateTime can easily be converted to a VARIANT of VT_DATE type using COleVariant. This will be exactly the format that Access's automation interface will be expecting. ------------------------ Derek Waters derek@lj-oz.com

                  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