问题描述
如何使用Linq到Sql将日期格式转换为dd / MM / yyyy
我尝试如下:
DataTable dt = Common.dc.TblMaintenances.Where(a => a.ContractId == Id && a.IsScheduled == true || a.IsScheduled == false).OrderBy(a => a.ScheduledDate)。选择(a = > new {a.MaintenanceId,a.MaintenanceDate.ToString(dd.MM.yy),a.MaintenancePerson,a.Remarks,a.ScheduledDate,a.IsScheduled,a.Cost})。getDataTable();
但是没有工作
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
这篇关于如何使用Linq to Sql将日期格式转换为dd / MM / yyyy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!