DateTime.Compare output

Discussion in 'ASP .Net' started by Martin Eyles, Sep 26, 2006.

  1. Martin Eyles

    Martin Eyles Guest

    Hi,

    What is the unit of the output from DateTime.Compare.

    Seconds, minutes, hours or days? or something else

    Thanks,
    Martin
    Martin Eyles, Sep 26, 2006
    #1
    1. Advertising

  2. Martin Eyles

    Anant Guest

    Martin Eyles wrote:
    > Hi,
    >
    > What is the unit of the output from DateTime.Compare.
    >
    > Seconds, minutes, hours or days? or something else
    >
    > Thanks,
    > Martin



    Hi Martin,
    The DateTime.Compare method returns a relative value
    denoting which of the two instances being compared is greater. I dont
    think this return value in any case relates to the actual seconds,
    hours or minutes of the two instances.
    Here is a msdn link so that my point is clear to you

    http://msdn2.microsoft.com/en-us/library/system.datetime.compare.aspx

    Thanks !
    Anant, Sep 26, 2006
    #2
    1. Advertising

  3. Martin Eyles

    Martin Eyles Guest

    "Anant" <> wrote in message
    news:...
    >
    > Martin Eyles wrote:
    >>
    >> What is the unit of the output from DateTime.Compare.
    >>
    >> Seconds, minutes, hours or days? or something else
    >>

    >
    > The DateTime.Compare method returns a relative value
    > denoting which of the two instances being compared is greater. I dont
    > think this return value in any case relates to the actual seconds,
    > hours or minutes of the two instances.
    > Here is a msdn link so that my point is clear to you
    >
    > http://msdn2.microsoft.com/en-us/library/system.datetime.compare.aspx


    I understand. I want to get the difference between these two in seconds. Do
    you know of a way to do this?

    Thanks again,

    Martin
    Martin Eyles, Sep 26, 2006
    #3
  4. to get that do (date1 - date2).TotalSeconds
    --
    Y2KPRABU, MCP, INDIA
    WEB APPS


    "Martin
    =?Utf-8?B?WTJLUFJBQlU=?=, Sep 26, 2006
    #4
  5. Martin Eyles

    coolCoder Guest

    coolCoder, Sep 26, 2006
    #5
  6. Martin Eyles

    Martin Eyles Guest

    Very neat, but I get the error "Operator '-' is not defined for types 'Date'
    and 'Date'."

    "Y2KPRABU" <> wrote in message
    news:...
    > to get that do (date1 - date2).TotalSeconds
    > --
    > Y2KPRABU, MCP, INDIA
    > WEB APPS
    >
    >
    > "Martin
    Martin Eyles, Sep 26, 2006
    #6
  7. Martin Eyles

    Martin Eyles Guest

    Martin Eyles, Sep 26, 2006
    #7
  8. ok try this date1.Subtract(date2).TotalSeconds;
    --
    Y2KPRABU, MCP, INDIA
    WEB APPS


    "Martin Eyles" wrote:

    > Very neat, but I get the error "Operator '-' is not defined for types 'Date'
    > and 'Date'."
    >
    > "Y2KPRABU" <> wrote in message
    > news:...
    > > to get that do (date1 - date2).TotalSeconds
    > > --
    > > Y2KPRABU, MCP, INDIA
    > > WEB APPS
    > >
    > >
    > > "Martin

    >
    >
    >
    =?Utf-8?B?WTJLUFJBQlU=?=, Sep 27, 2006
    #8
  9. Martin Eyles

    Martin Eyles Guest

    Thanks!

    This works. It is a shame I can't use operator overloading in VB.net.
    Perhaps I should switch to C# - I like some of its other syntax better too -
    '{' and '}' for code blocks is much better than 'END'. That may have to wait
    till my next project though - too much code to convert otherwise.

    Martin


    "Y2KPRABU" <> wrote in message
    news:...
    > ok try this date1.Subtract(date2).TotalSeconds;
    >
    >
    > "Martin Eyles" wrote:
    >
    >> Very neat, but I get the error "Operator '-' is not defined for types
    >> 'Date'
    >> and 'Date'."
    >>
    >> "Y2KPRABU" <> wrote in message
    >> news:...
    >> > to get that do (date1 - date2).TotalSeconds
    Martin Eyles, Sep 27, 2006
    #9
  10. can u pls close this saying that this was answered and rate it too.
    --
    Y2KPRABU, MCP, INDIA
    WEB APPS


    "Martin Eyles" wrote:

    > Thanks!
    >
    > This works. It is a shame I can't use operator overloading in VB.net.
    > Perhaps I should switch to C# - I like some of its other syntax better too -
    > '{' and '}' for code blocks is much better than 'END'. That may have to wait
    > till my next project though - too much code to convert otherwise.
    >
    > Martin
    >
    >
    > "Y2KPRABU" <> wrote in message
    > news:...
    > > ok try this date1.Subtract(date2).TotalSeconds;
    > >
    > >
    > > "Martin Eyles" wrote:
    > >
    > >> Very neat, but I get the error "Operator '-' is not defined for types
    > >> 'Date'
    > >> and 'Date'."
    > >>
    > >> "Y2KPRABU" <> wrote in message
    > >> news:...
    > >> > to get that do (date1 - date2).TotalSeconds

    >
    >
    >
    =?Utf-8?B?WTJLUFJBQlU=?=, Sep 27, 2006
    #10
  11. Martin Eyles

    Martin Eyles Guest

    Close What? Rate?

    This is usenet!


    "Y2KPRABU" <> wrote in message
    news:D...
    > can u pls close this saying that this was answered and rate it too.
    > --
    > Y2KPRABU, MCP, INDIA
    > WEB APPS
    >
    >
    > "Martin Eyles" wrote:
    >
    >> Thanks!
    >>
    >> This works. It is a shame I can't use operator overloading in VB.net.
    >> Perhaps I should switch to C# - I like some of its other syntax better
    >> too -
    >> '{' and '}' for code blocks is much better than 'END'. That may have to
    >> wait
    >> till my next project though - too much code to convert otherwise.
    >>
    >> Martin
    >>
    >>
    >> "Y2KPRABU" <> wrote in message
    >> news:...
    >> > ok try this date1.Subtract(date2).TotalSeconds;
    >> >
    >> >
    >> > "Martin Eyles" wrote:
    >> >
    >> >> Very neat, but I get the error "Operator '-' is not defined for types
    >> >> 'Date'
    >> >> and 'Date'."
    >> >>
    >> >> "Y2KPRABU" <> wrote in message
    >> >> news:...
    >> >> > to get that do (date1 - date2).TotalSeconds

    >>
    >>
    >>
    Martin Eyles, Sep 27, 2006
    #11
  12. yes u can do that thro web.. that helps us..
    http://msdn.microsoft.com/wn3/locales/help/help_en-us.htm#RateAPost
    see this snippet i took from msdn help..
    isnt it possible in usenet

    Rate a post as an answer (or not an answer) to your question
    (Note that you cannot rate a post that you have authored.)

    When someone replies to a question you asked, you can rate this post as an
    answer, or not an answer to your question. By rating a post as an answer, you
    help others find the answer more quickly, you give credit to the person who
    posted the answer, and you help increase the quality of answers in the
    discussion group.

    In the thread pane, select the post that is a response to a question you
    asked.
    In the message pane, do one of the following:
    If the post answers your question, click Yes next to Did this post answer
    the question?
    If the message was not helpful to you, click No next to Did this post answer
    the question?
    The post you rated is now marked as an answer, and the thread is now marked
    as an answered question, and will be returned in search results.
    Additionally, the person who posted this answer is credited with an answered
    question (this is added to their profile information).


    --
    Y2KPRABU, MCP, INDIA
    WEB APPS


    "Martin Eyles" wrote:

    > Close What? Rate?
    >
    > This is usenet!
    >
    >
    > "Y2KPRABU" <> wrote in message
    > news:D...
    > > can u pls close this saying that this was answered and rate it too.
    > > --
    > > Y2KPRABU, MCP, INDIA
    > > WEB APPS
    > >
    > >
    > > "Martin Eyles" wrote:
    > >
    > >> Thanks!
    > >>
    > >> This works. It is a shame I can't use operator overloading in VB.net.
    > >> Perhaps I should switch to C# - I like some of its other syntax better
    > >> too -
    > >> '{' and '}' for code blocks is much better than 'END'. That may have to
    > >> wait
    > >> till my next project though - too much code to convert otherwise.
    > >>
    > >> Martin
    > >>
    > >>
    > >> "Y2KPRABU" <> wrote in message
    > >> news:...
    > >> > ok try this date1.Subtract(date2).TotalSeconds;
    > >> >
    > >> >
    > >> > "Martin Eyles" wrote:
    > >> >
    > >> >> Very neat, but I get the error "Operator '-' is not defined for types
    > >> >> 'Date'
    > >> >> and 'Date'."
    > >> >>
    > >> >> "Y2KPRABU" <> wrote in message
    > >> >> news:...
    > >> >> > to get that do (date1 - date2).TotalSeconds
    > >>
    > >>
    > >>

    >
    >
    >
    =?Utf-8?B?WTJLUFJBQlU=?=, Sep 27, 2006
    #12
  13. Martin Eyles

    Martin Eyles Guest

    "Y2KPRABU" <> wrote in message
    news:...
    > yes u can do that thro web.. that helps us..
    > http://msdn.microsoft.com/wn3/locales/help/help_en-us.htm#RateAPost
    > see this snippet i took from msdn help..
    > isnt it possible in usenet
    >
    > "Martin Eyles" wrote:
    >
    >> Close What? Rate?
    >>
    >> This is usenet!
    >>
    >>
    >> "Y2KPRABU" <> wrote in message
    >> news:D...
    >> > can u pls close this saying that this was answered and rate it too.


    I am not using the web to read this newsgroup, I am using usenet. I do not
    know of any facility in any usenet client to add ratings to articles,
    although admitedly I am using one of the less featured usenet clients,
    Outlook Express. For info about usenet, see the wikipedia article

    http://en.wikipedia.org/wiki/USENET

    Also, I should point out that you are bound to meet a much more angry
    response from a lot of usenet users - take a look at this url for an example

    http://www.google.com/search?q="not a web forum"

    In any case, I'll be more restrained,

    Martin
    Martin Eyles, Sep 27, 2006
    #13
    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. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    687
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  2. Tim Peters
    Replies:
    0
    Views:
    522
    Tim Peters
    Sep 9, 2003
  3. mp
    Replies:
    1
    Views:
    376
    John Machin
    Jul 28, 2006
  4. Martin
    Replies:
    0
    Views:
    328
    Martin
    Dec 27, 2008
  5. Replies:
    2
    Views:
    744
    M.-A. Lemburg
    Jan 6, 2009
Loading...

Share This Page