Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Get Day/Month/Year from Date Object in JavaScript</title> </head> <body> <script> var d = new Date(); var date = d.getDate(); var month = d.getMonth() + 1; // Since getMonth() returns month from 0-11 not 1-12 var year = d.getFullYear(); var dateStr = date + "/" + month + "/" + year; document.write(dateStr); </script> </body> </html>