Formatting datestamp gives me a wrong date[SOLVED]

hello,
i am getting a datestamp from json file.it gives me the wrong date.back to 1970
i have this function in my controller

$scope.formatDate = function(date){
          var dateOut = new Date(date);
          return dateOut;
    };

then in the view

Date:{{article2.PhorumMessage.datestamp|date:"d/m/y à HH:mm"}}

how to fix that?
i am expecting 18 may 2017 i get 18/18/1970

thank you

Try ‘d MMMM yyyy’ as the format string for the date filter.

For more information see : https://docs.angularjs.org/api/ng/filter/date

i gave it a try but still got the same result.the same result when i used a converter it gave me the correct date

actually i solved it .the datestamp was in milliseconds.multiply by 1000. thanks for the help mate

1 Like