function formatDate() {
var now = Date.parse(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();
// return year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second;
return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
}
//如果记得时间戳是毫秒级的就需要*1000 不然就错了记得转换成整型
var d = new Date();
log(d)
//************************************
log("**************************************")
function Ftime(time) {
if (time) {
return new java.text.SimpleDateFormat("yyyy-MM-dd").format(new Date(time));
} else {
return new java.text.SimpleDateFormat("yyyy-MM-dd").format(new Date());
}
}
auto.js B0049 显示当前时间
最新推荐文章于 2022-10-22 08:06:49 发布