var timestamp1 = Date.parse(new Date()); console.log(timestamp1); //杈撳嚭褰撳墠鏃堕棿鐨勬椂闂存埑var date = new Date(1520324618000); console.log(date); Y = date.getFullYear() + '-'; M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'; D = date.getDate() + ' '; h = date.getHours() + ':'; m = date.getMinutes() + ':'; s = date.getSeconds(); console.log(Y+M+D+h+m+s);
相关推荐:
以上就是js时间戳和普通时间相互转换方法代码的详细内容,更多请关注php中文网其它相关文章!