If the date format $scope.timestamp = '2016-12-16 07:02:15 am'
I want to format to 16/12/2016 07:02:15 am
I tried this code below and it works well
$scope.originalStamp = $filter('date')
(new Date($scope.timestamp.replace("-","/")),'dd-MM-yyyy HH:mm:ss a');
But my question is: why is it new Date($scope.timestamp)always returned nullif you do not use the replacement of char from (-) to (/)?
see below code does not work if am without using replace().
$scope.originalStamp = $filter('date')
(new Date($scope.timestamp),'dd-MM-yyyy HH:mm:ss a');
Why new Date()doesn't it accept if the date format is (-)? Is the new Date () conversion dependent on my system date format?
source
share