// <Editor-fold desc = "PHP time conversion phpstr: timestamp to turn, typ: type of the output"> function to_date_time (phpstr, type) { // the console.log (phpstr); STR = the parseInt (phpstr) * 1000; // the stamp into php shaping and multiplied by 1000 var newDate = new new a Date (STR); var year = newDate.getUTCFullYear (); // get Year var month the newDate.getUTCMonth = () +. 1; / / take month var nowday newDate.getUTCDate = () +. 1; // take days var hours newDate.getHours = (); // get h var minutes = newDate.getMinutes (); // get minutes var seconds = newDate.getSeconds();//取秒 // console.log(year + "-" + month + "-" + nowday + " " + hours + ":" + minutes + ":" + seconds); if (type == "1") { return year + "." + month + "." + nowday //拼接 2017-2-21 } else { return year + "-" + month + "-" + nowday + " " + hours + ":" + minutes + ":" + seconds;//拼接 2017-2-21 12:23:43 } } //</editor-fold>