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. CDateTimeCtrl,CTime

CDateTimeCtrl,CTime

Scheduled Pinned Locked Moved C / C++ / MFC
databasetutorialquestion
5 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.
  • K Offline
    K Offline
    Kamesh
    wrote on last edited by
    #1

    :confused: Hi, In my database date is in text format (like 20030704) and i've to display that date in CDatetimeCtrl, after getting year month and date i am assigning that to control as follows CTime tm(yr,mn,dd,0,0,0); CDateTimeCtrl.SetTime( &tm ); It is showing correct in case year is above 1970, and showing currentdate if year is 1970- 'What could be the reason and any suggesstions how to solve it?? With Thanks and Regards --Kamesh

    R R 2 Replies Last reply
    0
    • K Kamesh

      :confused: Hi, In my database date is in text format (like 20030704) and i've to display that date in CDatetimeCtrl, after getting year month and date i am assigning that to control as follows CTime tm(yr,mn,dd,0,0,0); CDateTimeCtrl.SetTime( &tm ); It is showing correct in case year is above 1970, and showing currentdate if year is 1970- 'What could be the reason and any suggesstions how to solve it?? With Thanks and Regards --Kamesh

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      CTime doesn't support dates before Jan 1st, 1970. This is due to the C runtime library not supporting these dates in the time_t type. Use COleDateTime instead of CTime to get a greater time range. Hope this helps, Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
      Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

      R 1 Reply Last reply
      0
      • K Kamesh

        :confused: Hi, In my database date is in text format (like 20030704) and i've to display that date in CDatetimeCtrl, after getting year month and date i am assigning that to control as follows CTime tm(yr,mn,dd,0,0,0); CDateTimeCtrl.SetTime( &tm ); It is showing correct in case year is above 1970, and showing currentdate if year is 1970- 'What could be the reason and any suggesstions how to solve it?? With Thanks and Regards --Kamesh

        R Offline
        R Offline
        Rage
        wrote on last edited by
        #3

        I did not check back, but if I remember well, 1970 is the lowest date you can have in a CTime. So maybe you should use a COleDateTime, which is also DateTimeCtrl compliant and which can contain any date/time. ~RaGE();

        1 Reply Last reply
        0
        • R Ryan Binns

          CTime doesn't support dates before Jan 1st, 1970. This is due to the C runtime library not supporting these dates in the time_t type. Use COleDateTime instead of CTime to get a greater time range. Hope this helps, Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
          Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

          R Offline
          R Offline
          Rage
          wrote on last edited by
          #4

          If we keep on posting the same answers at the same time, I'll quit. ;P ~RaGE();

          R 1 Reply Last reply
          0
          • R Rage

            If we keep on posting the same answers at the same time, I'll quit. ;P ~RaGE();

            R Offline
            R Offline
            Ryan Binns
            wrote on last edited by
            #5

            Rage wrote: If we keep on posting the same answers at the same time, I'll quit. :eek: Don't do that! I find that that happens a lot - I'm always posting at the same time as other people. I think it's just me :) OT: I think I've got the record for the fastest reply :). I posted a reply to a message last night so quickly that it showed up when the guy who posted the original message got back to the forum page after sending his message :eek: How's that for posting speed? :cool: Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
            Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

            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