Javascript examples for Date Operation:Time Format
Format time from local time
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from w w w . jav a 2 s.c o m*/ var dateLocal = new Date(); var dateString = (dateLocal.getMonth() + 1) + "/" + dateLocal.getDate() + "/" + dateLocal.getFullYear()+" "+dateLocal.getHours() + ":" + dateLocal.getMinutes() + ":" + dateLocal.getSeconds() ; console.log(dateString); } </script> </head> <body> </body> </html>