Converting OLE Automation Dates back into regular date/time?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TofuTheGreat@gmail.com

    #1

    Converting OLE Automation Dates back into regular date/time?

    I'm using "Now.ToOADa te" for a record timestamp in a small database app
    (it's what I want to do so don't try to disuade me ;-D).

    Anyway. I store the value of Now.ToOADate in a string field in the
    database (16 character field on a SQL server to be exact). Is there a
    way of converting the text value from that field back into a readable
    date/time?

    For example if a date is stored in the 16 character field as the OLE
    Automation format "38876.49419028 94" then what do I need to do to work
    it backward to get a regular date/time format (i.e. human readable) in
    my VB.Net application?

    I've been Googling for the technique but I don't know how to word my
    search query so I haven't found anything useful.

  • Oenone

    #2
    Re: Converting OLE Automation Dates back into regular date/time?

    TofuTheGreat@gm ail.com wrote:[color=blue]
    > Anyway. I store the value of Now.ToOADate in a string field in the
    > database (16 character field on a SQL server to be exact). Is there a
    > way of converting the text value from that field back into a readable
    > date/time?[/color]

    \\\
    newDate = DateTime.FromOA Date(CDbl(yourS tring))
    ///

    HTH,

    --

    (O)enone


    Comment

    • TofuTheGreat@gmail.com

      #3
      Re: Converting OLE Automation Dates back into regular date/time?


      Oenone wrote:[color=blue]
      > TofuTheGreat@gm ail.com wrote:[color=green]
      > > Anyway. I store the value of Now.ToOADate in a string field in the
      > > database (16 character field on a SQL server to be exact). Is there a
      > > way of converting the text value from that field back into a readable
      > > date/time?[/color]
      >
      > \\\
      > newDate = DateTime.FromOA Date(CDbl(yourS tring))
      > ///
      >
      > HTH,
      >
      > --
      >
      > (O)enone[/color]

      HAHA I was just coming back to say "NM" I found a reference to the
      FromOADate() in another post and looked it up. So dteStoredDate =
      DateTime.FromOA Date(strStoredD ate) worked like a charm!

      Thanks (O)enone!

      Comment

      Working...