User457850011 posted
I have a column of integers values of dates, for example 20120103 and want to convert these integers to datetime but getting an error " String was not recognized as a valid DateTime error" using the code below. Any help would be appreciated
var today = DateTime.Now.AddDays(-1).Date;
var Data = (from u in Users()
from c in u.employees
from h in c.admin
from s in h.teams
where
(DateTime.ParseExact(s.admitInitial.ToString(), "dd-MM-yyyy HH:mm:ss", null) <= today
|| DateTime.ParseExact(s.admitFinal.ToString(), "dd-MM-yyyy HH:mm:ss", null) <= today)
select c).Distinct();