Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi, i want to take only date part from datetime values which are coming from db , i have written like as following, but it is showing error

var RequiredDetails = (from s in spe.Submissions
C#
select new
                                       {
                                           SubmissionDate=s.SubmissionDate.ToString("dd/mm/yyyy"),

});
please help me to solve this.
Posted

1 solution

Go for this :
C#
s.SubmissionDate.Value.Date

or
C#
s.SubmissionDate.Value.ToShortDateString()
 
Share this answer
 
Comments
pavan_ kumar 24-Sep-14 9:14am    
i have tried these two, both are showing errors
KaushalJB 24-Sep-14 9:25am    
http://forums.asp.net/t/1716584.aspx?how+to+remove+Time+in+dateTime+using+linq+

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900