0
I would like to convert the bank coming date (2012-02-10) to Brazilian standard (10/02/2012) in AJAX Success, example:
$.ajax({
type: 'POST',
dataType: 'json',
url: "crud/consulta.php",
data: dados,
success: function(data) {
$('.dataFiltro').val(data.data);
// AQUI ALGUMA CONVERSÃO
});
Or some way to do the conversion in the form input, being that, this value will be filled in an input. Some suggestion w
Blow her up with the
split
and change the order, like this Jsfiddle– William Novak
Thank you William.
– Alisson Hoepers
I recommend using regular expression.
data.data.replace(/^(\d+)\-(\d+)\-(\d+)$/, "$3/$2/$1")
.– user21448
How would you do with a date and time field?
– Alisson Hoepers
When you say "date of the bank’s arrival (2012-02-10)" Is that always the format? How are you setting the time on the server?
– Sergio
You saw my question here? ^
– Sergio
For example, the format always comes (2012-02-10 12:25:50) accurate convert to 10/02/2012 12:25:50
– Alisson Hoepers