标签:
<script type="text/javascript"> var time = "2015-04-22 21:41:43";//2015-4-22 21:41:43 var temp = time.split(‘ ‘); var arr = temp[0].split(‘-‘); var brr = temp[1].split(‘:‘); var timestamp = new Date(Date.UTC(arr[0],arr[1]-1,arr[2],brr[0]-8,brr[1],brr[2])); var timestamp = timestamp/1000; alert(timestamp); function getDate(tm){ var tt=new Date(parseInt(tm) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ") return tt; } alert(getDate(‘1429711045‘)); </script>
标签:
原文地址:http://www.cnblogs.com/liuswi/p/4448840.html