//js将php时间戳转换成格式化日期function to_date(phpstr) {str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000var 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;//拼接 -2-21 12:23:43 }}
600字范文,内容丰富有趣,生活中的好帮手!