I would recommend passing in an array to the datetime.parseexact() formula that @AkshaySandhu pointed out.
If you think there might be additional formats in the future, you can put the string array in your config file for easy alteration without needing to re-publish your code