Parsing a date - Javascript Date Operation

Javascript examples for Date Operation:Date Parse

Description

Parsing a date

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(){/* www.  j  a  v  a  2s.  c  o  m*/
    var date = "03/05/2013";
    var dateParts = date.split("/");
    var day = dateParts[0];
    var month = dateParts[1];
    var year = dateParts[2];
    console.log('Year: ' + year + ', Month: ' + month + ', Day: ' + day);
}

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

Related Tutorials