I want to save from HTML to PHP via Angularjs the value of "time" attribute.
In my HTML i have :
<input type="time" ng:model="stime.val" ng:value="stime.val | date: 'HH:mm:ss'" >
In the controller :
$scope.stime = { val: new Date(1970, 0, 1, 09, 00, 00) };
$scope.sendtime = [{ 'time' : $scope.stime }];
http({ method: 'POST', url: '../index.php',
data : $.param({ 'sendTime' : $scope.sendtime,
'type' : 'post_time'
}),
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
}).success( cut off code...
In PHP :
header("Content-Type: application/json; charset=utf-8");
$postResponse = file_get_contents("php://input");
json_decode($postResponse);
if($_POST['type'] == 'post_time')
{
$startTime = $_POST['sendTime']['val'];
print_r($startTime);
}
The returned data is ( let's say i input "15:06:04" )
Tue Dec 01 2015 15:06:04 GMT+0000 (GMT Standard Time)
My Question is, how can i make it to return just the time from HTML?
Something like this..
15:06:04