Convert 'Today' as double

A

Alan T

C#.

How do I convert today's date as a double type value?

I tried:

double weekOf;

weekOf = ToDouble(DateTime.Today);

Response.Write(weekOf.ToString());

It displayed:

2.xxxxE-266



That is a very, very small frational number.
 
H

Harlan Messinger

Alan said:
C#.

How do I convert today's date as a double type value?

I tried:

double weekOf;

weekOf = ToDouble(DateTime.Today);

This can't be what you tried because it wouldn't have compiled. And if
you had tried

weekOf = Convert.ToDouble(DateTime.Today)

you would have gotten an InvalidCastException, according to
http://msdn.microsoft.com/en-us/library/hfdd1sd9.aspx.
Response.Write(weekOf.ToString());

It displayed:

2.xxxxE-266

That is a very, very small frational number.

Even if you had gotten a result from whatever it is you tried, why would
you expect it to have any particular value, or magnitude of value, given
that there is no relationship between doubles and DateTimes?
 

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

Top