时间戳

// //设置跨域访问
// app.all('*', function (req, res, next) {
//     res.header("Access-Control-Allow-Origin", "*");
//     res.header("Access-Control-Allow-Headers", "X-Requested-With");
//     res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");
//     res.header("X-Powered-By", ' 3.2.1');
//     res.header("Content-Type", "application/json;charset=utf-8");
//     next();
// });

// var date = new Date();
// var hh = date.getHours();
// var mm = date.getMinutes();
// var ss = date.getSeconds();
// var yy = date.getFullYear();
// var MM = date.getMonth() + 1;  //因为1月这个方法返回为0,所以加1          
// var dd = date.getDate();
// var nowday = new Date(yy, MM, dd, hh, mm, ss).toLocaleString().replace("年", "-").replace("月", "-").replace("日", "");
// console.log(nowday);

js获取当前时间搓
var timestamp = Math.round(new Date() / 1000)
console.log(timestamp);

你可能感兴趣的:(时间戳)