Re: DateTime.Compare question



On May 28, 2:58 pm, SandpointGuy
<Sandpoint...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
string dateTime = "5/28/2008";

DateTime.Compare(DateTime.Now,DateTime.Now) // returns 0
DateTime.Compare(DateTime.Now,DateTime.Parse(dateTime)) // returns 1

I need to compare 2 dates, using the second format, and I
dont understand why it isnt returning 0

Thank you

Hi,
DateTme.Now include a time component.
Also it might be possible that the first line (using Now both times)
give also <>1, depending of how fast both evaluations are performed
.



Relevant Pages

  • Re: DateTime.Compare question
    ... SandpointGuy wrote: ... I need to compare 2 dates, using the second format, and I ... dont understand why it isnt returning 0 ...
    (microsoft.public.dotnet.languages.csharp)
  • sysdate without time
    ... What is the best way to assign sysdate to a column in a trigger with time component set 00:00:00? ... Also how can one compare a column to sysdate in a query, while ignoring the time components in both? ...
    (comp.databases.oracle.server)
  • Re: datetim convertion to date
    ... to have datetime, you will also have time component. ... if you want to compare only the date component, ... GetDate(), 110). ...
    (microsoft.public.sqlserver.programming)