HighTechTalks DotNet Forums  

Convert 'Today' as double

ASP.net ASP.net discussions (microsoft.public.dotnet.framework.aspnet)


Discuss Convert 'Today' as double in the ASP.net forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Alan T
 
Posts: n/a

Default Convert 'Today' as double - 07-04-2010 , 07:28 PM






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
  #2  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: Convert 'Today' as double - 07-05-2010 , 12:10 PM






Alan T wrote:
Quote:
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.

Quote:
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 Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.