Is there a way to compare date "strings" in C# without converting the strings?

Posted by Kevin on Stack Overflow See other posts from Stack Overflow or by Kevin
Published on 2010-04-26T11:18:09Z Indexed on 2010/04/26 11:23 UTC
Read the original article Hit count: 132

Filed under:

I have two fields:

string date1 = "04/26/10";
string date2 = "04/25/10";

How can I compare these two fields like so?:

if (date2 <= date1)
{
  // perform some code here
}

Can this be done without first converting the fields to a separate date-type variable?

© Stack Overflow or respective owner

Related posts about c#