I am trying to parse a string date which is in DDMMYYYY
format using following code but it is returning false even though 16062001
is a valid date in DDMMYYYY
format.
DateTime.TryParseExact("16062001", "DDMMYYYY", CultureInfo.InvariantCulture,DateTimeStyles.None,out parsed);
Try with lower case d
and y
as per https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx
Eg.
DateTime.TryParseExact("16062001", "ddMMyyyy", CultureInfo.InvariantCulture,DateTimeStyles.None,out parsed);