时间字符串生成小标签
javascript:(function() {
const now = new Date();
const year = now.getFullYear().toString().substr(-2);
const month = ('0' + (now.getMonth() + 1)).slice(-2);
const day = ('0' + now.getDate()).slice(-2);
const hours = ('0' + now.getHours()).slice(-2);
const minutes = ('0' + now.getMinutes()).slice(-2);
const seconds = ('0' + now.getSeconds()).slice(-2);
const code = year + month + day + hours + minutes + seconds;
const el = document.createElement('textarea');
el.value = code;
el.setAttribute('readonly', '');
el.style.position = 'absolute';
el.style.left = '-9999px';
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
alert('已将时间字符串复制到剪贴板中:' + code);
})();
格式是 YYMMDDhhmmss。