【发布时间】:2017-07-11 11:46:19
【问题描述】:
我正在以下列格式从服务器获取日期。
“2017-07-10T20:51:13.000Z”。
但是当我要更改“dd/MM/yyyy”格式的日期格式时,它会自动增加一天。
请检查这个 plunkr。
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.date = '2017-07-10T20:51:13.000Z';
});
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.2.x" src="http://code.angularjs.org/1.2.14/angular.js" data-semver="1.2.14"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<p ng-bind="date | date:'MM/dd/yyyy'"></p>
</body>
</html>
我的实际日期是 7 月 10 日,但我的结果是 7 月 11 日 请帮助我如何解决这个问题。
【问题讨论】:
标签: javascript angularjs date