I guess you have a limited alphabet that your time formats can be constructed of. That means, "HH"
would always be "hours" on the 24-hour clock, "dd"
always the day with leading zero, and so on.
Because of the sequential nature of a time format, you could try to tokenize a format string of "dd/mm/yyyy HH:nn"
into an array ["dd", "/", "mm", "/", "yyyy", " ", "HH", ":", "nn"]
. Then go ahead and form a pattern string from that array by replacing "HH"
with "([01][0-9]|2[0-3])"
and so on. Preconstruct these pattern atoms into a lookup table/array. All parts of your array that are not in the lookup table are literals. Escape them to according regex rules and append them to you pattern string.
EDIT: As a side effect for a regex based solution, when you put all regex "atoms" of your lookup table into parens and keep track of their order in a given format string, you would be able to use sub-matches to extract the required components from a match and feed them into a CreateDate function, thus skipping the ParseDate part altogether.