0

I get data from database with angularjs. In database it looks like "01.01.1970 18:00:00", but on page it diplayed like this: "/Date(25200000)/". How can I solve this problem?

C# method:

[HttpGet]
public JsonResult GetFilial(int id)
{       
    PersonModel person = db.Persons.Find(id);
    FilialModel filial = db.Filials.FirstOrDefault(f => f.Name.Equals(person.BranchOffice));
    return Json(filial, JsonRequestBehavior.AllowGet);
}

AngularJS code:

$http({
    url: "/Contact/GetFilial",
    params: { id: $routeParams.id },
    method: "get"
}).then(function(response) {
    $scope.thisFilial = response.data;
});

Html code:

<p>Open time: {{thisFilial.OpenTime | date:'HH:mm'}}</p>

Thank you for help!

AGB
  • 2,230
  • 1
  • 14
  • 21
Bodryi
  • 33
  • 8
  • It's the JSON serialization format that is messing up with your date. – Fals May 19 '16 at 19:47
  • Thank you! You helped a lot! I googled it a lot of times, but i didn't know that the problem was in JSON format. Sorry for duplicating. – Bodryi May 19 '16 at 20:03
  • If you want to sleep well at nights, working with dates and javascript, have a look at MomentJS :-) – Frode May 19 '16 at 20:07

0 Answers0