Convert date time to String - Javascript String Operation

Javascript examples for String Operation:String Convert

Description

Convert date time to String

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {// w ww. ja v  a  2 s .c o m
var d = new Date();
  var _day = d.getDay();
  var _month = d.getMonth() + 1; //months are zero based
  var _year = d.getFullYear();
var str = _day + "-" + _month  + "-" +  _year + " 00:00:00";
console.log(str);
    });

      </script> 
   </head> 
   <body>  
   </body>
</html>

Related Tutorials