Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert date from yyyyMMdd format to mm-dd-yyyy format

Tags:

I want to convert a string which contains the date in yyyyMMdd format to mm-dd-yyyy DateTime format. How do I get it?

like image 714
PramodChoudhari Avatar asked Jan 17 '11 10:01

PramodChoudhari


1 Answers

var dateString = "20050802"; var date = myDate = DateTime.ParseExact(dateString,                                     "yyyyMMdd",                                     System.Globalization.CultureInfo.InvariantCulture); 
like image 114
Daniel Elliott Avatar answered Oct 08 '22 01:10

Daniel Elliott