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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. dates

dates

Scheduled Pinned Locked Moved C / C++ / MFC
question
16 Posts 6 Posters 3 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.
  • N Offline
    N Offline
    Neal beavis
    wrote on last edited by
    #1

    Hi guys and gurls, Does anyone know how u can get two dates and then work out the difference s that it can display someones age?

    I C CPalliniC D K 5 Replies Last reply
    0
    • N Neal beavis

      Hi guys and gurls, Does anyone know how u can get two dates and then work out the difference s that it can display someones age?

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      In MFC: To get two dates from controls on a dialog, look at: CDateTimeCtrl. To work with date / times, use CTime. To subtract them, you can use CTimeSpan also. That should give you things to search for and learn from. Iain.

      In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!

      1 Reply Last reply
      0
      • N Neal beavis

        Hi guys and gurls, Does anyone know how u can get two dates and then work out the difference s that it can display someones age?

        C Offline
        C Offline
        Cedric Moonen
        wrote on last edited by
        #3

        If you are using MFC, you can use CTime[^] and CTimeSpan[^]

        Cédric Moonen Software developer
        Charting control [v1.5] OpenGL game tutorial in C++

        N 1 Reply Last reply
        0
        • C Cedric Moonen

          If you are using MFC, you can use CTime[^] and CTimeSpan[^]

          Cédric Moonen Software developer
          Charting control [v1.5] OpenGL game tutorial in C++

          N Offline
          N Offline
          Neal beavis
          wrote on last edited by
          #4

          No im using visual basics and i really only know the basics of visual so dont really knowhwo to use what you have suggested :(

          C CPalliniC 2 Replies Last reply
          0
          • N Neal beavis

            Hi guys and gurls, Does anyone know how u can get two dates and then work out the difference s that it can display someones age?

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #5

            That's no sooo difficult. Like you are able to compute, inwardly, someone's age, given its date of birth, so you should be able to code the algo. :)

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            In testa che avete, signor di Ceprano?

            N 1 Reply Last reply
            0
            • CPalliniC CPallini

              That's no sooo difficult. Like you are able to compute, inwardly, someone's age, given its date of birth, so you should be able to code the algo. :)

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
              This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
              [My articles]

              N Offline
              N Offline
              Neal beavis
              wrote on last edited by
              #6

              culd you use something like cin>>dateToday cin>>birthDate cout<<dateToday-birthDate=age ?

              CPalliniC 1 Reply Last reply
              0
              • N Neal beavis

                No im using visual basics and i really only know the basics of visual so dont really knowhwo to use what you have suggested :(

                C Offline
                C Offline
                Cedric Moonen
                wrote on last edited by
                #7

                Neal beavis wrote:

                No im using visual basics

                Why are you posting this in the C++ forum then ? :sigh:

                Cédric Moonen Software developer
                Charting control [v1.5] OpenGL game tutorial in C++

                N 1 Reply Last reply
                0
                • N Neal beavis

                  No im using visual basics and i really only know the basics of visual so dont really knowhwo to use what you have suggested :(

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #8

                  Neal beavis wrote:

                  No im using visual basics and i really only know the basics of visual

                  Good pun. :laugh: BTW be aware: Visual Basic developers shouldn't taint this forum. :rolleyes:

                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                  [My articles]

                  In testa che avete, signor di Ceprano?

                  1 Reply Last reply
                  0
                  • C Cedric Moonen

                    Neal beavis wrote:

                    No im using visual basics

                    Why are you posting this in the C++ forum then ? :sigh:

                    Cédric Moonen Software developer
                    Charting control [v1.5] OpenGL game tutorial in C++

                    N Offline
                    N Offline
                    Neal beavis
                    wrote on last edited by
                    #9

                    sorry everyone i get them mixed up everytime visual studio

                    C 1 Reply Last reply
                    0
                    • N Neal beavis

                      sorry everyone i get them mixed up everytime visual studio

                      C Offline
                      C Offline
                      Cedric Moonen
                      wrote on last edited by
                      #10

                      So, you are using Visual C++ then ? Which kind of application did you create (console, win32 or MFC) ?

                      Cédric Moonen Software developer
                      Charting control [v1.5] OpenGL game tutorial in C++

                      N 1 Reply Last reply
                      0
                      • C Cedric Moonen

                        So, you are using Visual C++ then ? Which kind of application did you create (console, win32 or MFC) ?

                        Cédric Moonen Software developer
                        Charting control [v1.5] OpenGL game tutorial in C++

                        N Offline
                        N Offline
                        Neal beavis
                        wrote on last edited by
                        #11

                        win 32 consol

                        1 Reply Last reply
                        0
                        • N Neal beavis

                          Hi guys and gurls, Does anyone know how u can get two dates and then work out the difference s that it can display someones age?

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #12

                          How about difftime()?

                          "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                          N 1 Reply Last reply
                          0
                          • D David Crow

                            How about difftime()?

                            "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                            "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                            N Offline
                            N Offline
                            Neal beavis
                            wrote on last edited by
                            #13

                            how do u use this my friend :s

                            D 1 Reply Last reply
                            0
                            • N Neal beavis

                              Hi guys and gurls, Does anyone know how u can get two dates and then work out the difference s that it can display someones age?

                              K Offline
                              K Offline
                              ky_rerun
                              wrote on last edited by
                              #14

                              Take a look at here


                              a programmer traped in a thugs body

                              1 Reply Last reply
                              0
                              • N Neal beavis

                                how do u use this my friend :s

                                D Offline
                                D Offline
                                David Crow
                                wrote on last edited by
                                #15

                                Neal beavis wrote:

                                how do u use this...

                                By consulting the documentation: http://msdn.microsoft.com/en-us/library/3wbd7281(VS.71).aspx[^]

                                "Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

                                "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                                1 Reply Last reply
                                0
                                • N Neal beavis

                                  culd you use something like cin>>dateToday cin>>birthDate cout<<dateToday-birthDate=age ?

                                  CPalliniC Offline
                                  CPalliniC Offline
                                  CPallini
                                  wrote on last edited by
                                  #16

                                  It actually doesn't look a good plan. :)

                                  If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                  This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                  [My articles]

                                  In testa che avete, signor di Ceprano?

                                  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