I have a string which needs to be converted and validated to a DateTime. The string is in the following format ‘dd.mm.yy’
I am trying to convert it to DateTime using the following
string format = "dd.mm.yy";
date = DateTime.ParseExact(current.Substring(aiRule.AiLength), format,
CultureInfo.InvariantCulture);
but unfortunately this fails.
The question is how to convert a string in the format ‘dd.mm.yy’ to a DateTime ?
Thank you
mmmeans “minutes”. I suspect you want"dd.MM.yy". See MSDN for more information about custom date and time format strings.(In particular, read the part about the “yy” specifier and how it chooses which century to use. If you can possibly change the input to use a four digit year, that could save you some problems…)