I have a date as string in the following format:
yyyy-mm-dd
e.g.
2011-08-29
I want to check two dates and see if date1 is smaller than date2.
pseudocode:
string date1 = "2011-08-29";
string date2 = "2011-09-29";
if (date1 < date2) {
MessageBox.Show("First date is smaller!");
}
If it’s guaranteed that the dates are always in that exact format, a string comparison is sufficient.