Posts Tagged ‘irregular date format’


Getting date from irregular date format:

July 12, 2010

 C# not clear about some irregular date formats like  ‘yyyyMMdd’ (20100712).  We can get date from these format of text. Use this coding to covert that dateTime format to needed date time format.


String strDate = “20100712”; 

DateTime MyDateConverted = DateTime.ParseExact(strDate, “yyyyMMdd”, System.Globalization.CultureInfo.InvariantCulture); 

strDate = MyDateConverted.ToString(@”MMMM d, yyyy”);