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. Need to convert DWORD to Date Time

Need to convert DWORD to Date Time

Scheduled Pinned Locked Moved C / C++ / MFC
21 Posts 8 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.
  • Y yaminisridaran

    I have a DWORD value 524642425 I need to see this value in Date Time Can i know how to use to get the value using COleDateTime.

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

    What CPallini wanted to know (I suppose) is how is your date coded into your DWORD ?

    Cédric Moonen Software developer
    Charting control [v1.3]

    Y CPalliniC 2 Replies Last reply
    0
    • C Cedric Moonen

      What CPallini wanted to know (I suppose) is how is your date coded into your DWORD ?

      Cédric Moonen Software developer
      Charting control [v1.3]

      Y Offline
      Y Offline
      yaminisridaran
      wrote on last edited by
      #6

      Yes I using a dll the DWORD is return from that dll and the Datetime is coded in that value.I want to check that date and time in vc++

      C 1 Reply Last reply
      0
      • Y yaminisridaran

        Yes I using a dll the DWORD is return from that dll and the Datetime is coded in that value.I want to check that date and time in vc++

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

        :sigh: Please try to understand what we are asking before replying. How is the date encoded in the DWORD ? In other word, what does a digit represent ? A second, a milisecond, ... ? To which date correspond the 0 value ?

        Cédric Moonen Software developer
        Charting control [v1.3]

        CPalliniC R 2 Replies Last reply
        0
        • C Cedric Moonen

          What CPallini wanted to know (I suppose) is how is your date coded into your DWORD ?

          Cédric Moonen Software developer
          Charting control [v1.3]

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

          You suppose correctly, my friend. :)

          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

          In testa che avete, signor di Ceprano?

          Y 1 Reply Last reply
          0
          • C Cedric Moonen

            :sigh: Please try to understand what we are asking before replying. How is the date encoded in the DWORD ? In other word, what does a digit represent ? A second, a milisecond, ... ? To which date correspond the 0 value ?

            Cédric Moonen Software developer
            Charting control [v1.3]

            CPalliniC Online
            CPalliniC Online
            CPallini
            wrote on last edited by
            #9

            Now, I suppose he doesn't know. :)

            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

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • CPalliniC CPallini

              You suppose correctly, my friend. :)

              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

              Y Offline
              Y Offline
              yaminisridaran
              wrote on last edited by
              #10

              Indicates in 100-nanosecond intervals the stop time of this sample. The above mention is the sdk document we have regarding the DWORD

              CPalliniC S 2 Replies Last reply
              0
              • Y yaminisridaran

                Indicates in 100-nanosecond intervals the stop time of this sample. The above mention is the sdk document we have regarding the DWORD

                CPalliniC Online
                CPalliniC Online
                CPallini
                wrote on last edited by
                #11

                Finally!!!!

                yaminisridaran wrote:

                The above mention is the sdk document we have regarding the DWORD

                I strongly doubt that it is the SDK's reference of DWORD (i.e. please indicate the function to which SDK help actually refers). Your number represents roughly 52 seconds, what conversion do you need? :)

                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

                In testa che avete, signor di Ceprano?

                1 Reply Last reply
                0
                • Y yaminisridaran

                  Indicates in 100-nanosecond intervals the stop time of this sample. The above mention is the sdk document we have regarding the DWORD

                  S Offline
                  S Offline
                  Sarath C
                  wrote on last edited by
                  #12

                  Check Various Time Functions available and find the suitable one[^] I think the value you have is the result of "GetTickCount()" API.

                  -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

                  My blog - Sharing My Thoughts, An Article - Understanding Statepattern

                  C CPalliniC 2 Replies Last reply
                  0
                  • S Sarath C

                    Check Various Time Functions available and find the suitable one[^] I think the value you have is the result of "GetTickCount()" API.

                    -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

                    My blog - Sharing My Thoughts, An Article - Understanding Statepattern

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

                    GetTickCount returns a number of miliseconds, not a number of 100-nanoseconds.

                    Cédric Moonen Software developer
                    Charting control [v1.3]

                    1 Reply Last reply
                    0
                    • S Sarath C

                      Check Various Time Functions available and find the suitable one[^] I think the value you have is the result of "GetTickCount()" API.

                      -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

                      My blog - Sharing My Thoughts, An Article - Understanding Statepattern

                      CPalliniC Online
                      CPalliniC Online
                      CPallini
                      wrote on last edited by
                      #14

                      Actually 100-nanosend intervals are recorded inside FILETIME struct, hence functions like GetSystemTimeAsFileTime are possible candidates. :)

                      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

                      In testa che avete, signor di Ceprano?

                      L 1 Reply Last reply
                      0
                      • C Cedric Moonen

                        :sigh: Please try to understand what we are asking before replying. How is the date encoded in the DWORD ? In other word, what does a digit represent ? A second, a milisecond, ... ? To which date correspond the 0 value ?

                        Cédric Moonen Software developer
                        Charting control [v1.3]

                        R Offline
                        R Offline
                        Rajesh R Subramanian
                        wrote on last edited by
                        #15

                        Cedric Moonen wrote:

                        Please try to understand what we are asking before replying.

                        5! That'd solve almost 99% of all problems in the world, I'd say. :laugh:

                        Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                        1 Reply Last reply
                        0
                        • CPalliniC CPallini

                          Actually 100-nanosend intervals are recorded inside FILETIME struct, hence functions like GetSystemTimeAsFileTime are possible candidates. :)

                          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

                          L Offline
                          L Offline
                          led mike
                          wrote on last edited by
                          #16

                          This is fun! Can I have a turn guessing at what function he used to get the value? Pleeeeeezzzz, it's urgent!

                          led mike

                          R CPalliniC 2 Replies Last reply
                          0
                          • L led mike

                            This is fun! Can I have a turn guessing at what function he used to get the value? Pleeeeeezzzz, it's urgent!

                            led mike

                            R Offline
                            R Offline
                            Rajesh R Subramanian
                            wrote on last edited by
                            #17

                            Damn it! Stand in the queue.

                            Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP

                            1 Reply Last reply
                            0
                            • L led mike

                              This is fun! Can I have a turn guessing at what function he used to get the value? Pleeeeeezzzz, it's urgent!

                              led mike

                              CPalliniC Online
                              CPalliniC Online
                              CPallini
                              wrote on last edited by
                              #18

                              Yes, now it's your turn. Turn ended (do you realize we're talking about 100-nanosecond intervals? It is fu****g urgent!!!!). :)

                              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

                              In testa che avete, signor di Ceprano?

                              1 Reply Last reply
                              0
                              • Y yaminisridaran

                                I need to convert DWORD to Date time. Can any one suggest me

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

                                Based on the limited information you've provided, I'd go with something like:

                                DWORD dw = 524642425;
                                Date time dt = dw; ;)

                                Now if you want a more helpful, detailed answer, please rethink your question. Ask yourself something like, "What does 524642425 represent?" Is it the number of seconds since the start of time, or the number of milliseconds since Windows was last started, or the number of nanoseconds since the start of the year, etc?

                                "Love people and use things, not love things and use people." - Unknown

                                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                                L 1 Reply Last reply
                                0
                                • Y yaminisridaran

                                  I need to convert DWORD to Date time. Can any one suggest me

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

                                  A nanosecond is one billionth of a second. If you are storing Time in a DWORD represented as 100 nanoseconds then you would not be able to store very much time. a DWORD is a32-bit unsigned integer (0 through 4294967295). You are probably recieving a FILETIME structure: http://msdn2.microsoft.com/en-us/library/ms724284(VS.85).aspx[^] If for some reason you are actually using a DWORD then you can get seconds like this and work from there.DWORD dwTime = 524642425; DWORD dwSeconds = (dwTime/10000000); //52.4642425 seconds
                                  Best Wishes, -David Delaune

                                  1 Reply Last reply
                                  0
                                  • D David Crow

                                    Based on the limited information you've provided, I'd go with something like:

                                    DWORD dw = 524642425;
                                    Date time dt = dw; ;)

                                    Now if you want a more helpful, detailed answer, please rethink your question. Ask yourself something like, "What does 524642425 represent?" Is it the number of seconds since the start of time, or the number of milliseconds since Windows was last started, or the number of nanoseconds since the start of the year, etc?

                                    "Love people and use things, not love things and use people." - Unknown

                                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                                    L Offline
                                    L Offline
                                    led mike
                                    wrote on last edited by
                                    #21

                                    DavidCrow wrote:

                                    please rethink your question

                                    So you assume thinking was previously involved eh? Interesting. ;)

                                    led mike

                                    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