Linq to sql date format problem
LINQ
2
Posts
2
Posters
0
Views
1
Watching
-
Hi There, I am new to linq to sql.I want to know how to convert dates in various format just like we convert in simple sql query. For example:- convert(varchar,datefield,106)
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()};Hope it helps :) Vote me
Niladri Biswas