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”);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: