0

I want to get the date in this format YYYY/MM/DD.I am calling a webservice to get the data.The date format returned by the service in xml is fine but when i append that in js i am getting

/Date(3257950500000)/

Webservice

  [WebMethod]
    public List<Common.Deposit.Views.DepositAccountStatementView> GetDepositAccountStatement(long accountNumberId,
        DateTime fromDate, DateTime toDate)
    {
        return BusinessLayer.Deposit.DepositAccountStatement.GetDepositAccountStatementViews(accountNumberId,
            fromDate, toDate);
    }

JS

if (data) {
  var div = $('#CfDataTable').empty();
  div.append(
    $("<tr class='success'><th>Tran Date</th><th>Value Date</th><th>Statement Reference</th><th>Collector</th><th>Debit</th><th>Credit</th><th>Balance</th><th>Check Number</th></tr>"));
  $(data.d).each(function(index, item) {
    div.append(
      $("<tr>")

      .append($("<td>").html(item.TranDate))
      .append($("<td>").html(item.ValueDate))
      .append($("<td>").html(item.StatementReference))
      .append($("<td>").html(item.Collector))
      .append($("<td>").html(item.Debit))
      .append($("<td>").html(item.Credit))
      .append($("<td>").html(item.Balance)));

  });
}

XML

<DepositAccountStatementView>
<TranId>13018256</TranId>
<TranDate>2016-01-14T00:00:00</TranDate>
<ValueDate>2016-01-14T00:00:00</ValueDate>
<Collector>Office</Collector>
<Debit xsi:nil="true"/>
<Credit>11000</Credit>
<Balance>11000</Balance>
</DepositAccountStatementView>

Help Please.I am new to this.Help appreciated.spend hours couldnt get through.

OLDMONK
  • 382
  • 2
  • 7
  • 25
  • 1
    show the `xml snippet`, `item.TranDate`, `item.ValueDate` regarding the dates - you claim "date format returned by the service in xml is fine" yet it is the most crucial information, and you left it out – birdspider Dec 01 '17 at 18:11
  • Date formatting and jQuery `.append()` have nothing in common. –  Dec 01 '17 at 18:15
  • @birdspider i have updated the question sir.i have added the xml output. – OLDMONK Dec 01 '17 at 18:15
  • 1
    Use this : $("").after($.datepicker.formatDate('yy/mm/dd', new Date())); – sricheta ruj Dec 01 '17 at 18:39

0 Answers0