Convert 'Today' as double

Discussion in 'ASP .Net' started by Alan T, Jul 5, 2010.

  1. Alan T

    Alan T Guest

    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.
    Alan T, Jul 5, 2010
    #1
    1. Advertising

  2. 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?
    Harlan Messinger, Jul 5, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Web learner

    from List <double> to double[]

    Web learner, Apr 25, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    462
  2. sb
    Replies:
    4
    Views:
    297
    Alberto Barbati
    Feb 19, 2004
  3. da Vinci
    Replies:
    5
    Views:
    8,701
    da Vinci
    Jul 31, 2004
  4. Sydex
    Replies:
    12
    Views:
    6,451
    Victor Bazarov
    Feb 17, 2005
  5. Heiko Vogel
    Replies:
    3
    Views:
    545
    Method Man
    Sep 14, 2004
Loading...

Share This Page