CodeLab
Show Output
 
xxxxxxxxxx
19
 
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
<meta charset="utf-8">
5
<title>Get Day/Month/Year from Date Object in JavaScript</title>
6
</head>
7
<body>
8
    <script>    
9
    var d = new Date();
10
     
11
    var date = d.getDate();
12
    var month = d.getMonth() + 1; // Since getMonth() returns month from 0-11 not 1-12
13
    var year = d.getFullYear();
14
     
15
    var dateStr = date + "/" + month + "/" + year;
16
    document.write(dateStr);
17
    </script>
18
</body>
19
</html>  
 
Switch to SQL Mode

Share this example with Facebook, Twitter, Gmail. Please give us a Like, if you find it helpful.