php 和java是不一样的

PHP 需要先乘1000 java  不需要 

因为PHP传过来的是十位数

java传过来是十三位数

 

function formatDate() {
var now = new Date();
var year=now.getFullYear();
var month=now.getMonth()+1;
var date=now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
// var second=now.getSeconds();
if(hour < 10) {
hour = '0' + hour;
}
if(minute < 10) {
minute = '0' + minute;
}
return month+"-"+ date+" "+ hour + ":" + minute;
}

 

function formatDate(nows) {
var now = new Date(nows *1000);
var year=now.getFullYear();
var month=now.getMonth()+1;
var date=now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
// var second=now.getSeconds();
if(hour < 10) {
hour = '0' + hour;
}
if(minute < 10) {
minute = '0' + minute;
}
return year + "/" + month + "/" + date + " " +hour + ":" + minute;
}

posted on 2018-09-18 11:17  假装新手  阅读(107)  评论(0编辑  收藏  举报