471,599 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

How to convert a Variant time in C#?

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
Nov 17 '05 #1
2 4716
orc
OK - got it:
System.DateTime.FromOADate(VariantTimeValue).

orc

"orc" <or*@sol.dk> wrote in message
news:uz**************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #2

"orc" wrote...
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
Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Angus Comber | last post: by
1 post views Thread by michael mazanek | last post: by
2 posts views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.