0
I found that code: angular function to pick up date and time
I tested it and it works great. But I need to take this date and send it to the bank, along with other data. How can I do this?
My code is like this:
$scope.enviarMsg = function (mensagem) {
function Time($scope){
$scope.date = new Date();
}
var dte = Time($scope);
var enviaMsg = {
mensagem: mensagem,
idUsuario: $window.localStorage.getItem('idUsuario'),
idCep: $window.localStorage.getItem('idCep'),
nome: $window.localStorage.getItem('nome'),
date: dte
}
$http.post("http://www.vigilantescomunitarios.com/www/php/enviaMsgLogra.php", enviaMsg).success(function (data){
console.log(data);
pegaMsgsLogra();
$scope.mensagem = {
msg: ""
}
});
}
You are assigning the
dte
a date, this is not being sent in JSON?– DiegoAugusto
Not @Techies, not being sent to JSON. See the image I posted.
– GustavoSevero
I’m not seeing the picture.
– DiegoAugusto
I just put it.
– GustavoSevero
Try to take this test:
date: new Date();
instead ofdate: dte
– DiegoAugusto
It was, but in a strange way: "[day] => 2016-02-16T17:44:18.851Z"
– GustavoSevero
This is the default, you will have to format the date in a way to send to BD or send it as Varchar
– DiegoAugusto
Thanks for the help, but I already got it with this site: http://momentjs.com/
– GustavoSevero