Click here to Skip to main content
15,912,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to convert date format to dd/MM/yyyy using Linq to Sql

I tried as below:
DataTable dt = Common.dc.TblMaintenances.Where(a => a.ContractId == Id && a.IsScheduled == true || a.IsScheduled == false).OrderBy(a => a.ScheduledDate).Select(a => new { a.MaintenanceId, a.MaintenanceDate.ToString("dd.MM.yy"), a.MaintenancePerson,a.Remarks,a.ScheduledDate,a.IsScheduled,a.Cost }).getDataTable();
But didn't work
Posted
Updated 18-Mar-13 22:45pm
v2

Hey for the format you are looking for you will need to use a.MaintenanceDate.ToString("dd/MM/yyyy")
 
Share this answer
 
Comments
Korathu 2 19-Mar-13 4:57am    
DataTable dt = Common.dc.TblMaintenances.Where(a => a.ContractId == Id && a.IsScheduled == true || a.IsScheduled == false).OrderBy(a => a.ScheduledDate).Select(a => new { a.MaintenanceId,a.MaintenanceDate.ToString("dd/MM/yyyy"), a.MaintenancePerson, a.Remarks, a.ScheduledDate, a.IsScheduled, a.Cost }).getDataTable();
Tried but its error
 
Share this answer
 
Comments
Korathu 2 19-Mar-13 5:28am    
Tried..Didn't work..Please give correct answer..

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