const now = new Date();
const zFill = (x, y) => ("" + x).padStart(y, 0);
// YYYYmmddHHMMSS
let timestamp =
zFill(now.getFullYear(), 4) +
zFill(now.getMonth() + 1, 2) +
zFill(now.getDate() + 1, 2) +
zFill(now.getHours(), 2) +
zFill(now.getMinutes(), 2) +
+zFill(now.getSeconds(), 2);
// YYYY-mm-dd HH:MM:SS
let timestamp = `${zFill(now.getFullYear(), 4)}-${zFill(
now.getMonth() + 1,
2
)}-${zFill(now.getDate() + 1, 2)} ${zFill(now.getHours(), 2)}:${zFill(
now.getMinutes(),
2
)}:${zFill(now.getSeconds(), 2)}`;
// YYYYmmddHHMMSS (UTC)
let timestamp =
zFill(now.getUTCFullYear(), 4) +
zFill(now.getUTCMonth() + 1, 2) +
zFill(now.getUTCDate() + 1, 2) +
zFill(now.getUTCHours(), 2) +
zFill(now.getUTCMinutes(), 2) +
+zFill(now.getUTCSeconds(), 2);
// YYYY-mm-dd HH:MM:SS (UTC)
let timestamp = `${zFill(now.getUTCFullYear(), 4)}-${zFill(
now.getUTCMonth() + 1,
2
)}-${zFill(now.getUTCDate() + 1, 2)} ${zFill(now.getUTCHours(), 2)}:${zFill(
now.getUTCMinutes(),
2
)}:${zFill(now.getUTCSeconds(), 2)}`;