I have a list coming from service, and I need the list to be sorted by date in that list. So I have done following.
List<ProgramInformation> programInformation = new List<DataAccess.ProgramInformation>();
foreach (StatusItem item in getStatusRes.StatusItems)
{
ProgramInformation programInformationItem = new ProgramInformation();
programInformationItem.EffectiveDate = Convert.ToDateTime(item.EffectiveDate.ToShortDateString());
programInformationItem.UpdatedBy = item.UpdatedBy;
programInformation.Add(programInformationItem);
}
programInformation.Sort((x, y) => x.EffectiveDate.CompareTo(y.EffectiveDate));
return programInformation;`
When I debug the list is getting sorted and Date field is good too. But When I display the date through Jquery, The date is showing up like this "Date(1386658800000)" Jquery Code:
<tr><td style='color:gray'>" + prgvalue.EffectiveDate
Please help. And I cant convert the datetime to string in C# code, as I need the sort functionality.