I use this code to show the next 2 days
var mydate= new Date();
mydate.setDate(mydate.getDate()+2)
document.write("Tomorrow Date :" +mydate.getDate()+"/"+(mydate.getMonth()+1)+"/"+mydate.getFullYear());
and it gives me a correct date, but I want it to have this format example: Jan-01-2012.
Can anyone help me on this? I tried using this string mydate.format('mmm,d,y'); and it returns none.
Thanks in adnvance
It’s impossible to format a
Datewith native javascript API.The only possible output with native API is the combination of
d,dd,ddd,M,MM,MMM,y,yy, andyyyyby usingtoString()andget*()methods and regular expression.So the better solution is to use a third party library, like moment.js.