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. Database & SysAdmin
  3. Database
  4. Please help, its very urgent ( retrieving datetime )

Please help, its very urgent ( retrieving datetime )

Scheduled Pinned Locked Moved Database
c++databasehelpquestion
4 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Consider the following: Database name - junkDB Table name - junk Fields - 1) slno char(10) 2) name char(20) 3) message char(200) 4) date_time datetime the 4th field is of type datetime. (eg: 07/20/2004 5:30:45 PM) i am connecting to the database using VC++ (SDK), using the #import (msado15.dll) statement. when i retrieve the date_time field, i get a floating point value (somewhat like this 37842.4578131) can someone help me with this. how can i retrieve the datetime field properly. thankyou, Deep George Zachariah

    C 1 Reply Last reply
    0
    • L Lost User

      Consider the following: Database name - junkDB Table name - junk Fields - 1) slno char(10) 2) name char(20) 3) message char(200) 4) date_time datetime the 4th field is of type datetime. (eg: 07/20/2004 5:30:45 PM) i am connecting to the database using VC++ (SDK), using the #import (msado15.dll) statement. when i retrieve the date_time field, i get a floating point value (somewhat like this 37842.4578131) can someone help me with this. how can i retrieve the datetime field properly. thankyou, Deep George Zachariah

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      deep_george_zach wrote: i get a floating point value (somewhat like this 37842.4578131) Possibly the number of days since 1/1/1901


      "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell The Second EuroCPian Event will be in Brussels on the 4th of September Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!

      L 1 Reply Last reply
      0
      • C Colin Angus Mackay

        deep_george_zach wrote: i get a floating point value (somewhat like this 37842.4578131) Possibly the number of days since 1/1/1901


        "If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell The Second EuroCPian Event will be in Brussels on the 4th of September Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!

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

        is there any way to get the datetime directly.... if no, then how do i convert the floating point number into date... any idea ?? thankyou Deep George

        V 1 Reply Last reply
        0
        • L Lost User

          is there any way to get the datetime directly.... if no, then how do i convert the floating point number into date... any idea ?? thankyou Deep George

          V Offline
          V Offline
          vikram attiganal
          wrote on last edited by
          #4

          Use the Format() method to format it in whatever way you want. Like Format("%Y-%m-%d") formats it to Year, Month and Day format. Format method is member of CTime class.

          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