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)

 

posted @ 2023-09-11 13:04  James·wang  阅读(110)  评论(0编辑  收藏  举报