How to convert a Variant time in C#?

  • Thread starter Thread starter orc
  • Start date Start date
O

orc

Hi there,

I'm receiving a variant time parameter (double) from a dll but how do I
convert it to something useful in C#?

Your help is highly appreciated!

Thanks,
orc
 
...
I'm receiving a variant time parameter (double) from a dll
but how do I convert it to something useful in C#?

Depending on its origin the double could mean almost anything, so you'd
better find out how the time is represented through this specific double.

However, a first guess would be that it's an OLE date value, equivalent to
the Date used e.g. in old VB.

If that's the case you should simply be able to use the static method of
DateTime:

DateTime newDate = DateTime.FromOADate(oldDate);


// Bjorn A
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top