Q:

js format date dd/mm/yyyy

let today = new Date()
today.toISOString().split('T')[0]
3
yourDate.toISOString().split('T')[0]
4
moment(new Date()).format("DD/MM/YYYY")
0
var date_format = new Date();

document.write(innerHTML = date_format.getMonth()+'/'+ date_format.getDate()+'/'+date_format.getFullYear());
1
<!DOCTYPE HTML> 
<html> 
  
<head> 
    <title> 
        JavaScript  
      | How to get current formatted date dd/mm/yyyy. 
    </title> 
</head> 
  
<body style="text-align:center;"
      id="body"> 
    <h1 style="color:green;">   
            GeeksForGeeks   
        </h1> 
    <p id="GFG_UP" 
       style="font-size: 15px; 
              font-weight: bold;"> 
    </p> 
    <button onclick="gfg_Run()"> 
        get Date 
    </button> 
    <p id="GFG_DOWN"
       style="color:green;  
              font-size: 20px;  
              font-weight: bold;"> 
    </p> 
    <script> 
        var el_up = document.getElementById("GFG_UP"); 
        var el_down = document.getElementById("GFG_DOWN"); 
        var today = new Date(); 
        el_up.innerHTML = today; 
  
        function gfg_Run() { 
            var date = today.toJSON().slice(0, 10); 
            var nDate = date.slice(8, 10) + '/'  
                       + date.slice(5, 7) + '/'  
                       + date.slice(0, 4); 
            el_down.innerHTML = nDate; 
        } 
    </script> 
</body> 
  
</html> 
0

New to Communities?

Join the community