Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Convert 'Today' as double

Reply
Thread Tools

Convert 'Today' as double

 
 
Alan T
Guest
Posts: n/a
 
      07-05-2010
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.


 
Reply With Quote
 
 
 
 
Harlan Messinger
Guest
Posts: n/a
 
      07-05-2010
Alan T wrote:
> 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?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
from List <double> to double[] Web learner ASP .Net 3 04-26-2006 05:26 PM
cannot convert parameter from 'double (double)' to 'double (__cdecl *)(double)' error Sydex C++ 12 02-17-2005 06:30 PM
Double double display display problem problem Tom Accuosti Firefox 3 09-27-2004 10:02 PM
How to convert a double **ptr in a double const ** const ptr? Heiko Vogel C Programming 3 09-14-2004 10:23 AM
Help: Double convert to Integer and Double.... da Vinci C++ 5 07-31-2004 12:35 AM



Advertisments