Javascript examples for Array Operation:Array Element
Date format with string and array' help
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//w w w . ja v a 2s. co m var std = new Date("2012/06/22 00:05:00 am"); var dateWS = "2012-06-22 00:05:00"; var date = dateWS.split(" ")[0].split("-"); var time = dateWS.split(" ")[1].split(":"); var dateObj = new Date(date[0],date[1],date[2],time[0],time[1],time[2]); var std_string = dateObj .getHours() + ":" + dateObj .getMinutes(); console.log(std_string); } </script> </head> <body> </body> </html>