2
Hello, How do I show the date generated in Brazilian format? I searched here and on the internet, but I could not execute as needed.
Behold:
$(document).ready(function () {
$("#button").click(function() {
var dias = 2;
var dataAtual = new Date();
var previsao = dataAtual.setDate(dataAtual.getDate() + dias);
$("#dPrev").val(dataAtual);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<input name="dPrev" type="text" class="form-control" id="dPrev" value="" placeholder="DD/MM/YYYY" required >
<button type="submit" id="button" name="button" class="btn btn-success pull-right"></i> Salvar</button>
It takes the current date, adds days and needs to show in the field as DD/MM/YYYYA
I appreciate any help.
Tiago, a good option is to use a plugin like Moment js. i like working with it. I recommend. ;)
– KaduAmaral