1 $scope.getDate = new Date();
2 
3             //可以当前日期
4             $scope.nowDate = $filter("date")($scope.getDate, "yyyy-MM-dd");
5             //获取前一天日期
6             $scope.oldDate = $filter("date")($scope.getDate - 86400000, "yyyy-MM-dd");
7             console.log($scope.nowDate,$scope.oldDate);


  注意:记得依赖注入$filter

 

  输出:2017-10-20 2017-10-19

相关文章:

  • 2021-12-11
  • 2022-12-23
  • 2021-12-29
  • 2021-07-28
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-16
猜你喜欢
  • 2021-11-28
  • 2021-10-11
  • 2022-12-23
  • 2022-01-11
  • 2022-12-23
  • 2021-12-19
相关资源
相似解决方案