Posts Tagged ‘irregular date format’

h1

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.

Coding:

String strDate = “20100712”; 

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

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