DateTime.Now inclides current time also. In the string you did not
give the time, means it takes as midnight 12:00. So its quite
meaningful to get 1 returned.
instead try the following
string dateTime = "5/29/2008";
DateTime.Compare(DateTime.Today, DateTime.Parse(dateTime)); //returns
0
Hope this should solve the issue that you are facing.
Thanks
Cnu
On May 28, 11:58*pm, SandpointGuy
<Sandpoint...@discussions.microsoft.comwrote:
string dateTime = "5/28/2008";
DateTime.Compare(DateTime.Now,DateTime.Now) // returns 0
DateTime.Compare(DateTime.Now,DateTime.Parse(dateT ime)) // returns 1
I need to compare 2 dates, using the second format, and I
dont understand why it isnt returning 0
Thank you