0
Good morning guys, I am passing to the server a string that would be for time: 23:45 is an example.
In my $_GET I’m trying to convert this way:
$prazo_entrega_min = time("hh:mm", strtotime($_GET['prazo_entrega_min']));
But without success. What can I do?
I am using in my controller to get this date the plugin ionicTimePicker (https://github.com/rajeshwarpatlolla/ionic-timepicker):
// TEMPO ENTREGA MINIMO
var ipObj1 = {
callback: function (val) { //Mandatory
if (typeof (val) === 'undefined') {
console.log('Time not selected');
} else {
var selectedTime = new Date(val * 1000);
console.log(selectedTime.getUTCHours(), 'H :', selectedTime.getUTCMinutes(), 'M');
$scope.entrega_min = selectedTime.getUTCHours() + ':' + selectedTime.getUTCMinutes();
window.localStorage.setItem("prazo_min_entrega", $scope.entrega_min)
console.log($scope.entrega_min);
}
},
inputTime: 50400, //Optional
format: 24, //Optional
step: 15, //Optional
setLabel: 'OK' //Optional
};
$scope.openTimePicker = function () {
ionicTimePicker.openTimePicker(ipObj1);
};
I am storing in my localstorage the values just to check, they are all in string:
What I do wrong?
With strtotime() only, 14:00 it stores as 838:59:59
– Ramos
@branches your code must be modifying the variable
prazo_entrega_min
after that. See here the original function values: https://eval.in/746598– Ricardo Moraleida