DateTime To Float

I have a Delphi DateTime in the registry represented as a float (i.e 90074.3829327199).  The problem is that I need to take a DateTime in C# and represent it in the same fashion.  Does anyone know how to do this?
Todd710Asked:
Who is Participating?
 
effesCommented:
I'm not 100% sure about it, but it sounds like it's an OLE Automation date. If that's the case the methods ToOADate and FromOADate of the DateTime class might be of use.
See http://msdn.microsoft.com/en-US/library/system.datetime.tooadate%28v=VS.80%29.aspx and http://msdn.microsoft.com/en-us/library/system.datetime.fromoadate%28VS.80%29.aspx for details.

Hope that helps.
0
 
theHollowCommented:
Hello
I once solved a similar problem by removing the decimal character so it ends up as an "Int64" (aka "long") type.
That way, you can use it as "ticks" when creating the DateTime.

Int64 ticks = createTicksFromValue(90074.3829327199);  // making it into 900743829327199
DateTime mydate = new DateTime(ticks);

But I'm not sure if this is the right approach for this, but I think it's worth mentioning :-)
0
 
Todd710Author Commented:
You save my bacon thanks for the quick answer!  I was that indeed.
0
 
effesCommented:
You're welcome.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.