Convert C# DateTime To Angular Date Convert C# DateTime To Angular Date angularjs angularjs

Convert C# DateTime To Angular Date


use the {sampledate.slice(6, -2) | date:'dd/MM/yyyy'}


var app = angular.module('app',[]);app.filter('ctime', function(){  return function(jsonDate){    var date = new Date(parseInt(jsonDate.substr(6)));    return date;  };});app.controller('fCtrl', function($scope){  $scope.date = '/Date(1420875802707)/';});


This seems to be issue with the serialization library you are using in .Net. Look at this blog post by Scott Hanselman

http://www.hanselman.com/blog/OnTheNightmareThatIsJSONDatesPlusJSONNETAndASPNETWebAPI.aspx

It talks about this very issue. Date should be serialized as ISO 8601 format.

You may have to change your serializer, see here Setting the Default JSON Serializer in ASP.NET MVC