The problem here is that the format "yyyyMM" cannot represent a specific DateTime . Therefore, parsing methods built in DateTime will not help you.
Update : it doesn’t matter; I stand fixed. DateTime.TryParseExact will work just fine (which is ironic if you ask me); it will interpret your string to represent the first day of a given month.
I would do what you describe: by analyzing a string in two numeric components and simply comparing these values with any range that you need so that they fall inside.
source share