Why does the code below result in a (-1)?
When the startDate is set to 7/9/12 5:00:00 AM the compareValue returns 1. I would expect a positive 1 in the scenario below but getting a (-1).
startDate = "7/16/2012 5:00:00 AM"
endDate = "7/17/2012 5:00:00 AM"
//enter code here
int compareValue = startDate.CompareTo(endDate);
You seem to compare
stringshere. If you compare using string ‘7/9/12 5:00:00 AM’ you get a result of1because'7/9/12 5:00:00 AM'is lexicographically larger than'7/17/2012 5:00:00 AM'.