gmt转换为本地时间格式(angularjs)

gmt转换为本地时间格式(angularjs),angularjs,Angularjs,我已经从php服务器上获取了它。试图像2016年9月9日那样展示它 角度: var request = $http({ method: "get", url: "dashboardServiceCall.php", headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }); /* Successful HTTP get request or not */ r

我已经从php服务器上获取了它。试图像2016年9月9日那样展示它

角度:

var request = $http({
      method: "get",
      url: "dashboardServiceCall.php",
      headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
    });

    /* Successful HTTP get request or not */
    request.success(function (data, status, headers, config) {
        z=0;
        for(var x=0; x < data.length; x++){
          if(data[x]['type'] == 1){
              $scope.getdatewasedetails[z] = data[x]['data']['dateWaseReportResForTests'][0];
              z++;
          }

          if(data[x]['type'] == 2){
              for(var y=0; y<data[x]['data']['dateWaseReportResForGroups'].length; y++){
                  $scope.getdatewasedetails[z] = data[x]['data']['dateWaseReportResForGroups'][y]['data']['dateWaseReportResForTests'][0];
                  z++;
              }
          }
      }
    });         
<tr ng-repeat="visits in getdatewasedetails | orderBy: '-testDate' | limitTo: 5" ng-class="{'criticalValue' : visits.testResult > visits.highValue || visits.lowValue > visits.testResult}" >
                                        <td>{{visits.testDate | date:'longDate'}}</td>

</tr>
var请求=$http({
方法:“获取”,
url:“dashboardServiceCall.php”,
标题:{'Content Type':'application/x-www-form-urlencoded'}
});
/*HTTP get请求是否成功*/
成功(函数(数据、状态、标题、配置){
z=0;
对于(var x=0;x

我尝试了一些更改,如
角度时区
,但失败了。任何帮助都会很好。提前感谢。

您需要date对象才能使用日期筛选器

尝试:


谢谢你,它工作了…但我不明白切片(0,10)在做什么?你能不能给你的ans做一个详细的说明以供进一步使用。所以你只是在考虑“2016-09-14”日期并将其更改为所需的格式。谢谢你的帮助,这不是一个有效的ISO日期字符串,可以传递给date对象,所以需要先将其解析为可用的部分
obj.testDate = new Date(obj.testDate.slice(0,10));