const d = new Date();
const year = d.getFullYear();
const month = d.getMonth();
const date = d.getDate();
let day = d.getDay();
result.textContent = `${year}年${month+1}月${date}日`;
const d = new Date();
const year = d.getFullYear();
const month = d.getMonth();
const date = d.getDate();
let day = d.getDay();
let reiwa = year - 2019;
if (reiwa === 0) {
reiwa = '元';
}
result.textContent =
`令和${reiwa}年${month+1}月${date}日`;
const d = new Date();
const year = d.getFullYear();
const month = d.getMonth();
const date = d.getDate();
let day = d.getDay();
const youbi = ['日', '月', '火', '水', '木', '金', '土'];
result.textContent = `${year}年${month+1}月${date}日(${youbi[day]})`;
const d = new Date();
const h = d.getHours();
const m = d.getMinutes();
result.textContent =
` ${String(h).padStart(2,'0')}:${String(m).padStart(2,'0')}`;
const d = new Date();
let ap = 'AM';
let h = d.getHours();
const m = d.getMinutes();
if (h >= 13) {
h -= 12;
ap = 'PM';
}
result.textContent =
`${ap} ${String(h).padStart(2,'0')}:${String(m).padStart(2,'0')}`;
const d = new Date();
let ap = 'AM';
let h = d.getHours();
const m = d.getMinutes();
const s = d.getSeconds();
if (h >= 13) {
h -= 12;
ap = 'PM';
}
result.textContent =
` ${ap} ${String(h).padStart(2,'0')}:${String(m).padStart(2,'0')}
:${String(s).padStart(2,'0')}`;