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. Convert CString to CTime / COleDateTime

Convert CString to CTime / COleDateTime

Scheduled Pinned Locked Moved C / C++ / MFC
questiondatabaseoracletutorial
8 Posts 4 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.
  • P Offline
    P Offline
    P Rex
    wrote on last edited by
    #1

    Hi guys, I have a string, for example '1085462900'. I have to convert this string into a CTime / COleDateTime value. How can i do this? I get this string from a oracle database. P. :cool:

    D J 2 Replies Last reply
    0
    • P P Rex

      Hi guys, I have a string, for example '1085462900'. I have to convert this string into a CTime / COleDateTime value. How can i do this? I get this string from a oracle database. P. :cool:

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

      What does that number represent?


      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

      P D 2 Replies Last reply
      0
      • P P Rex

        This number represents Date and Time. The field on the database is from type int which contains this number.

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

        P-Rex wrote: This number represents Date and Time. I figured that much out. Is it the number of seconds since a particular date? Is it the BCD form of a date? Be specific.


        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

        1 Reply Last reply
        0
        • D David Crow

          What does that number represent?


          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

          P Offline
          P Offline
          P Rex
          wrote on last edited by
          #4

          This number represents Date and Time. The field on the database is from type int which contains this number.

          D 1 Reply Last reply
          0
          • P P Rex

            Hi guys, I have a string, for example '1085462900'. I have to convert this string into a CTime / COleDateTime value. How can i do this? I get this string from a oracle database. P. :cool:

            J Offline
            J Offline
            JWood
            wrote on last edited by
            #5

            try CTime ct = CTime((time_t)(_atoi((const char*)cs))); and see if it matches the Oracle value

            P 1 Reply Last reply
            0
            • D David Crow

              What does that number represent?


              "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

              D Offline
              D Offline
              DavidR_r
              wrote on last edited by
              #6

              Just for the common knowlege. This number is called UTC time and represents the number of seconds ellapsed since 1.1.1970, it is 0+ GMT time zone without day light saving addition DavidR

              D 1 Reply Last reply
              0
              • D DavidR_r

                Just for the common knowlege. This number is called UTC time and represents the number of seconds ellapsed since 1.1.1970, it is 0+ GMT time zone without day light saving addition DavidR

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

                DavidR_r wrote: This number is called UTC time and represents the number of seconds ellapsed since 1.1.1970... Ok, both CTime and ColeDateTime have constructors for handling such a value.


                "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                1 Reply Last reply
                0
                • J JWood

                  try CTime ct = CTime((time_t)(_atoi((const char*)cs))); and see if it matches the Oracle value

                  P Offline
                  P Offline
                  P Rex
                  wrote on last edited by
                  #8

                  Thank you guys it works fine

                  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