We would like to know how to format date as dd/mm/yyyy in form of '6/6/2016'.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!-- www . j av a 2 s. com-->
var d1 = new Date();
var s1 = [d1.getDate(), d1.getMonth(), d1.getFullYear()].join('/');
document.writeln("first Date: " + s1);
document.writeln('<br/>');
var s2 = [d1.getDate(), d1.getMonth(), d1.getFullYear() + 1].join('/');
document.writeln("Second Date: " + s2 );
}
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: