Converting OLE Automation Dates back into regular date/time?

  • Thread starter Thread starter TofuTheGreat
  • Start date Start date
T

TofuTheGreat

I'm using "Now.ToOADate" 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.4941902894" 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.
 
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?

\\\
newDate = DateTime.FromOADate(CDbl(yourString))
///

HTH,
 
Oenone said:
\\\
newDate = DateTime.FromOADate(CDbl(yourString))
///

HTH,

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.FromOADate(strStoredDate) worked like a charm!

Thanks (O)enone!
 
Back
Top