php 时间戳转js的方法:首先打开相应的代码文件;然后通过“function to_date(phpstr) {...}”方法将php时间戳转换为js时间即可。
推荐:《php视频教程》
php时间戳转换为js时间
function to_date(phpstr) { str = parseint(phpstr) * 1000; var newdate = new date(str); var year = newdate.getutcfullyear(); var month = newdate.getutcmonth() + 1; var nowday = newdate.getutcdate(); var hours = newdate.gethours(); var minutes = newdate.getminutes(); var seconds = newdate.getseconds(); return year + "-" + month + "-" + nowday + " " + hours + ":" + minutes + ":" + seconds;//拼接 2017-2-21 12:23:43 } }
以上就是php 时间戳如何转js的详细内容。