Consider two strings
char dt1 []= "2016-05-14 15:23:00";
char dt2 []= "2016-05-13 19:11:32";
What would be a good way to test which is newer?
I've looked up Arduino Playground - Time but it seems this library is designed for time-keeping and is only capable of keeping one instance of time.
In that date time format, strcmp.
edit: That is assuming the day will also be a two digit number.
I'm glad I asked here before inventing too complicated things. Because of the format, strcmp worked indeed. Thanks for the both suggestions!
if (strcmp(dt1, dt2) < 0) {
Serial.println("d1 is older than d2");
}
else {
Serial.println("d1 is newer than d2");
}
Date/time in lexical order was designed for such comparisons and sorts. But interval calculations aren't as straightforward as they are with epoch time.