ji代码
<script>
var time="2017-6-12 15:13:2";
var ary=time.split(' ');
var ary1=ary[0].split('-');
var ary2=ary[1].split(':');
console.log(ary1,ary2);
var str=ary1[0]+'年'+ary1[1]+'月'+ary1[2]+'日'+' '+two(ary2[0])+'时'+two(ary2[1])+'分'+two(ary2[2])+'秒';
console.log(str);
function two(n){
if(n<10){
return '0'+n;
}
else{
return n;
}
}
</script>