ApplicationDate = DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
****************************************************************
The above code works fine and provides the application date in the format that I need. However sometimes str is blank. In that case the program throws an exception that the string is in invalid format.
How can I change this code so that it will parse and give me the date if available and if the date is unavailable assigns a value of null or minvalue for the applicationdate.
Would a Try Catch be a good approach? or is there a better way?
if (String.IsNullOrEmpty(str)
ApplicationDate = ''
else
ApplicationDate = DateTime.ParseExact(str, "yyyyMMdd", System.Globalization.Cultu
HTH
Ashok