JS——生成时间戳的函数
生成时间戳:
1.Date.now();
2.new Date().getTime()
生成YYYYMMDDHHMMSSMiMiMi格式
// 根据时间生成yyyymmddhhmmss,用来下载图片命名
const generateTime = function () {
const now = new Date();
const time =
now.getFullYear().toString() +
(now.getMonth() + 1) +
now.getDate() +
now.getHours() +
now.getMinutes() +
now.getSeconds() +
now.getMilliseconds();
return time;
};

浙公网安备 33010602011771号