suman goud

suman goud

  • NA
  • 176
  • 54.1k

How to bind date in correct format from database

Oct 13 2016 6:44 AM
am able to get date from database at controller , but when i passing that to view am getting date like this ""/Date(1473273000000)/""
i tried by converting , but no result
 
controoler.cs
public JsonResult GetPendings(int? pendingID)
{
string eid = pendingID.ToString();
TestDemoEntities db = new TestDemoEntities();
var data = (from ap in db.Accounting_PendingBills
join apa in db.Accounting_PendingBillsAdjusted on ap.BillRef equals apa.TowardsBillRef
group apa by new { ap.BillDate, ap.Amount, ap.Party, apa.TowardsBillRef } into g
select new
{
// BillDate = g.Key.BillDate,
BillDate = Convert.ToDateTime(g.Key.BillDate),
Party = g.Key.Party,
AmountAdjusted = g.Sum(aa => aa.AmountAdjusted)
}).Where(ap => ap.Party == eid).ToList();
 
 view
<tr ng-repeat="rm in ReceiptsViewModel ">
<td>
<input type="date" ng-model="rm.BillDate" class="input-xs" name="tdate" />
@*{{rm.BillDate|date}}*@
</td>
</tr>
JS(angular)
var getPendingData = ReceiptsService.GetPendings(c);
getPendingData.then(function (d) {
$scope.ReceiptsViewModel = d.data;
}
 

Answers (1)