C# Linq to Enitty Lamda中日期格式化,请使用SqlFunctions.DateName及SqlFunctions的其它用法
var data = db.Invoice.Select(i => new InvoiceVM { InvoiceId = i.InvoiceId, GroupIds = SqlFunctions.DateName("yyyy", i.BillDate )+"-"+SqlFunctions.DateName("MM", i.BillDate ),
Description = i.Description, CreateDate = i.CreateDate, }).OrderBy(i => i.InvoiceCode);
}
还有其它用法:
SqlFunctions.StringConvert(256236.36592,10,2)
微信号:jamesworkshop 学习QQ群:364976091