【发布时间】:2016-12-24 16:59:11
【问题描述】:
我有这段代码,它会根据日期(月份)产生一些统计数据
var customersList = customerDatesBLL.GetAll()
.Where(cust => cust.CaseDate != null)
.GroupBy(c => DateTime.ParseExact(c.CaseDate,"dd/MM/yyyy",null).Month)
.Select(c => new {
SumOfCustomer = c.Count(),
mount = int.Parse(c.Select(x => (DateTime.ParseExact(x.CaseDate,
"dd/MM/yyyy", null)).Month.ToString()).FirstOrDefault())
})
.ToList();
该代码总是产生FormatException:
字符串未被识别为有效的日期时间。
【问题讨论】:
-
向我们展示您的原始数据