My goal is to extract only the date from a DateTime object. The variable $scope.mytime holds both the date and time, but I am interested in just the date portion formatted as yyyy-MM-dd.
$scope.mytime = new Date();
I have attempted a few methods without success. For example:
$scope.mytime.getdate();
This code snippet only returns 8
, whereas I require the output in the format of yyyy-MM-dd.
Another attempt was made using:
$scope.newTime = $filter('date')(new Date(), "dd-MM-yyyy");
This resulted in an error stating: $filter is not defined
.