Javascript examples for Date Operation:Date Format
Format date from UTC string
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w ww . ja v a 2 s .co m var date = new Date("2018-01-30T16:01:31.1014286+00:00"); var dateString = date.getFullYear() + '-' + ("0" + (date.getMonth() + 1)).substr(-2) + '-' + ("0" + date.getDate()).substr(-2); var timeString = ("0" + date.getHours()).substr(-2) + ':' + ("0" + date.getMinutes()).substr(-2); console.log(dateString); console.log(timeString); } </script> </head> <body> </body> </html>