4
I have a string = "01/04/2012"
and need to convert to date(dd-mm-yyyy)
in javascript pure.
Follow what I’ve done:
var vencimento = localStorage.getItem('dados2'); //Busca a variável que contém a string = 01/04/2012
var vencimento2 = new Date(vencimento); // = Wed Jan 04 2012 00:00:00 GMT-0200 (Horário brasileiro de verão)
var vencimento3 = ???
How could I turn that date into DD-MM-YYYY
? I only found examples in jQuery.
Dude, but there’s no date. I did here it returns the date with string dnv, the same way I pull it
– guilhermedjc
When you assign
new Date(dataString[2], dataString[1]-1, dataString[0]);
, you already have the formatDate
, including adding, subtracting, changing values.– Valdeir Psr