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. How to Compare two Dates

How to Compare two Dates

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
6 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
    kiran janaswamy
    wrote on last edited by
    #1

    hi all, i am having a two DateTimePicker Control, i have selected Two Dates from that and put in a EditBox how to compare the Dates from the EditBox. Is this Possible with COleDateTime, if possible then please provide a snippet of Code. thanks, uday. uday kiran

    _ N 2 Replies Last reply
    0
    • K kiran janaswamy

      hi all, i am having a two DateTimePicker Control, i have selected Two Dates from that and put in a EditBox how to compare the Dates from the EditBox. Is this Possible with COleDateTime, if possible then please provide a snippet of Code. thanks, uday. uday kiran

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      You can see this link: http://www.codeproject.com/datetime/datetimecompare.asp[^] Vision is Always important and so is your ATTITUDE. Wishes. Anshuman Dandekar

      1 Reply Last reply
      0
      • K kiran janaswamy

        hi all, i am having a two DateTimePicker Control, i have selected Two Dates from that and put in a EditBox how to compare the Dates from the EditBox. Is this Possible with COleDateTime, if possible then please provide a snippet of Code. thanks, uday. uday kiran

        N Offline
        N Offline
        Nibu babu thomas
        wrote on last edited by
        #3

        kiran janaswamy wrote:

        how to compare the Dates from the EditBox. Is this Possible with COleDateTime

        Yes.

        kiran janaswamy wrote:

        if possible then please provide a snippet of Code

        COleDateTime dateOne(95, 3, 15, 12, 0, 0); // 15 March 1995 12 noon
        COleDateTime dateTwo(dateOne); // 15 March 1995 12 noon
        BOOL b;
        b = dateOne == dateTwo; // TRUE

        dateTwo.SetStatus(COleDateTime::invalid);
        b = dateOne == dateTwo; // FALSE, different status
        b = dateOne != dateTwo; // TRUE, different status
        b = dateOne < dateTwo; // FALSE, same value
        b = dateOne > dateTwo; // FALSE, same value
        b = dateOne <= dateTwo; // TRUE, same value
        b = dateOne >= dateTwo; // TRUE, same value

        And how to convert a string to COleDateTime object?? Use ParseDateTime.


        Nibu thomas Software Developer

        K 1 Reply Last reply
        0
        • N Nibu babu thomas

          kiran janaswamy wrote:

          how to compare the Dates from the EditBox. Is this Possible with COleDateTime

          Yes.

          kiran janaswamy wrote:

          if possible then please provide a snippet of Code

          COleDateTime dateOne(95, 3, 15, 12, 0, 0); // 15 March 1995 12 noon
          COleDateTime dateTwo(dateOne); // 15 March 1995 12 noon
          BOOL b;
          b = dateOne == dateTwo; // TRUE

          dateTwo.SetStatus(COleDateTime::invalid);
          b = dateOne == dateTwo; // FALSE, different status
          b = dateOne != dateTwo; // TRUE, different status
          b = dateOne < dateTwo; // FALSE, same value
          b = dateOne > dateTwo; // FALSE, same value
          b = dateOne <= dateTwo; // TRUE, same value
          b = dateOne >= dateTwo; // TRUE, same value

          And how to convert a string to COleDateTime object?? Use ParseDateTime.


          Nibu thomas Software Developer

          K Offline
          K Offline
          kiran janaswamy
          wrote on last edited by
          #4

          hi nibuthomas, if i have selected two dates from DateandTime Picker Control and put it in EditBox. this values are in the CString Format but they are not in COleDateTimeControl then how to Compare it. please provide a Solution for that. thanks, uday. uday kiran

          N 1 Reply Last reply
          0
          • K kiran janaswamy

            hi nibuthomas, if i have selected two dates from DateandTime Picker Control and put it in EditBox. this values are in the CString Format but they are not in COleDateTimeControl then how to Compare it. please provide a Solution for that. thanks, uday. uday kiran

            N Offline
            N Offline
            Nibu babu thomas
            wrote on last edited by
            #5

            Take a look at ParseDateTime and please kindly:) look up the documentation for further details.


            Nibu thomas Software Developer

            K 1 Reply Last reply
            0
            • N Nibu babu thomas

              Take a look at ParseDateTime and please kindly:) look up the documentation for further details.


              Nibu thomas Software Developer

              K Offline
              K Offline
              kiran janaswamy
              wrote on last edited by
              #6

              hi nimuthomas, i got it and many thanks to provide a solution. i am lucky. thanks and regards, uday. uday kiran

              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