Read the date and then calculate what the next item should be. If you read 201801 your expected next value should be 201802. If you read 201812 your next value should be 201901. Then check and see if the next value is equal to your expected next value. If they are not equal then the next value is missing.
You can do the same thing when the format is like 2018-01-31.