Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am recieving data object from webservice in angularjs. data object has date data type.
when i debug in angularjs method it coming as string like "/Date(1464238800000)/"

Angular code is
JavaScript
$scope.Data = data.Details.Data;


actual date value is : "05/26/2016 10:30:00"
how can i get this date in angularjs?

Please help me this

What I have tried:

JavaScript
$http({
   method: 'GET',
   url: resourceLoadUrl,
   headers: { 'Content-Type': 'application/json' },
   async: false,
  }).success(function (data, status) {
           $scope.Data = data.Details.Data;
    }).error(function (data, status) {
  });
Posted
Updated 3-Aug-17 12:04pm
v2
Comments
Andy Lanng 28-Jul-17 10:04am    
The date is correct (in milliseconds) but can I see the full json text or is that it?
Looks like the json is getting mangled somehow
You should still be able to parse the date out of it, but it would be better to solve the issue.

1 solution

You can use $filter service to format the date. Please make that$filter is inject on your controller as dependency
JavaScript
$scope.Data =  $filter("date")(new Date(yourDate), "MM/dd/yyyy h:mm")

Official Documentation[^]
Hope this helps
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900