【发布时间】:2017-12-03 18:27:03
【问题描述】:
我想减去从数据库中获取的 angularjs 中的两个日期。该代码适用于所有值,除了从数据库中获取的日期之间的减法......我将 PHP 与 MySQL 一起使用 谁能告诉我如何做这个减法。这是代码。提前感谢
<html>
<head>
<script src="angular.js"></script>
<script>
var app= angular.module("myapp",[]);
app.controller("mycontroller",function($scope,$http){
$http.get("select.php").success(function(response)
{
$scope.names = response.data.records;});
});
</script>
</head>
<body ng-app="myapp" ng-controller="mycontroller">
<table border=1>
<tr>
<th>ID </th>
<th>Name of employee</th>
<th>Start Date </th>
<th>End Date </th>
<th>No of days Worked </th>
</tr>
<tr ng-repeat="emp in names">
<td>{{emp.id}}</td>
<td>{{emp.name}}</td>
<td>{{emp.stDate}}</td>
<td>{{emp.enDate}}</td>
<td>{{emp.stDate-emp.enDate}}</td>
</tr>
</table>
</body>
【问题讨论】:
标签: php mysql angularjs date subtraction