473,461 Members | 1,399 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 4951
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mich | last post by:
I'm going crazy trying to convert an Access Function to SQL. From what I've read, it has to be done as a stored procedure. I'm trying to take a field that is "minutes.seconds" and convert it to...
28
by: MLH | last post by:
The largest integer A97 can deal with is 2,147,483,647, as I understand it from HELP. I would be content to represent larger integers as strings. For example, "2147483648" would suit me fine. I...
7
by: Angus Comber | last post by:
Hello I need to do this conversion but can't seem to find the function. Angus
1
by: michael mazanek | last post by:
Hi all, i have a VARIANT variable which contains a "friendly name" of a video-codec (direct show). Does anyone know how to retrieve the friendly name as a string to display it on the console? ...
8
by: Serge BRIC | last post by:
My application, written in .NET VB, tries to get a communication port handle from a TAPI object with this code: Dim vFileHandle As Byte() = appel.GetIDAsVariant("comm/datamodem") The...
1
by: darren.benn | last post by:
I need to convert this code to VB .NET (2003). Dim FaxMsg As IFaxMessage Set FaxMsg = gFC.NewMessage Dim Recip As Variant ' add a recipient to the fax recipients collection Set Recip =...
1
by: rhyme2ri2 | last post by:
Hello all, how can i convert a variant data type into image. Actually i am retrieving an image from CCD (camera) which is in variant format. Now i want to display this image in picture/image...
6
n8kindt
by: n8kindt | last post by:
i've got a brainteaser for you guys. let's say i have a form called "Form1"... now, i have a lot of fields on Form1 and get tired of typing out forms!form1.fillintheblank.value because they are...
6
by: nanaveraa | last post by:
Hai, i am tried to convert a .doc file into .rtf format file using jacob jar.i am written a code but its gives some error. In below i given that programs and error.please give me the solution...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.