Date Format Conversion for comparison - Javascript Date Operation

Javascript examples for Date Operation:Date Format

Description

Date Format Conversion for comparison

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(){//from  w w  w .  ja  va  2  s.  c o m
var userDate = "21/5/2013";
userDate = userDate.split("/");
var newDate = userDate[1]+"/"+userDate[0]+"/"+userDate[2];
var formattedUserDate = new Date(newDate);
console.log(formattedUserDate);
    }

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

Related Tutorials