Suppose I have a table storing a list of datetime (yyyyMMdd) in String format. How could I extract them and convert them into DateTime format dd/MM/yyyy ?
e.g. 20120101 -> 01/01/2012
I have tried the following:
var query = from tb in db.tb1 select new { dtNew = DateTime.ParseExact(tb.dt, "dd/MM/yyyy", null); };
But it turns out the error saying that the ParseExact function cannot be recgonized.