js时间凑转字符串和java时间转字符串

java转

SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String str = format.format(new Date());

js转

function time(time = +new Date()) {
    var date = new Date(time + 8 * 3600 * 1000); // 增加8小时 return date.toJSON().substr(0, 19).replace('T', ' '); } time();

猜你喜欢

转载自www.cnblogs.com/nyhhd/p/12560789.html