How can I show month names in my view instead of month numbers?
Action Method:
public ActionResult MyPerformance()
{
int year = DateTime.Now.Year;
DateTime firstDay = new DateTime(year, 1, 1);
DateTime lastDay = new DateTime(year, 12, 31).AddDays(1).AddSeconds(-1);
var result = db.Chats
.Where(c => System.Data.Entity.DbFunctions.TruncateTime(c.MSTChatCreatedDateTime) >= firstDay &&
System.Data.Entity.DbFunctions.TruncateTime(c.MSTChatCreatedDateTime) <= lastDay)
.Select(x => new { x.MSTChatCreatedDateTime })
.ToList()
.GroupBy(c => new
{
Year = c.MSTChatCreatedDateTime.ToCleanDateTime().Year,
Month = c.MSTChatCreatedDateTime.ToCleanDateTime().Month
})
.Select(c => new ReportVM
{
Title = string.Format("{0}", c.Key.Month), //chart x Axis value.
ChatCountCreatdDate = c.Count() //chart y Axis value.
})
.ToList();
return View(result);
}
Data being reflected is correct in the View, but I am not able to render the month names in the view.
See the attached Image showing the month numbers.
Thank you!