How to convert convert(varchar,datefield,106) of SQL's in LINQ?
Thanks in advance
How to convert convert(varchar,datefield,106) of SQL's in LINQ?
Thanks in advance
You can get a string representation of a date by using ToString()
myDate.ToString()
and a date representation of a string by parsing it.
DateTime.Parse(myDateString)
You just need to include your conversion in your select clause.
from myRecord in myDataContext.MyTable
select new {myStringDate = myRecord.myDate.ToString()};