How would I get the current date to display in jquery as "Saturday, October 31, 2015"? I can only find how to get the date to display as "dd/mm/yyyy"
To get 31/10/2015 use this :
// "31/10/2015" and august : 31/08/2015 :
var a=new Date();
alert([("0" + a.getDate()).slice(-2), ("0" + (a.getMonth()+1)).slice(-2), a.getFullYear()].join("/"));
// "31/10/2015" and august : 31/8/2015 :
[a.getDate(), (a.getMonth() + 1), a.getFullYear()].join("/");
Example :
function getDate() {
var a=new Date();
return [("0" + a.getDate()).slice(-2), ("0" + (a.getMonth() + 1)).slice(-2), a.getFullYear()].join("/");
}
document.write(getDate());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With