参考链接 1.https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat 2.https://www.fdbtech.com/zh-cn/docs/javascript/reference/global_objects/intl/datetimeformat
const options = {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
hour12: true,
minute: 'numeric',
second: 'numeric',
timeZone: 'Asia/Tokyo',
};
console.log(new Intl.DateTimeFormat('ja-JP-u-ca-japanese', options).format(new Date()));
const opt = {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: 'numeric',
hour12: false,
minute: 'numeric',
second: 'numeric'
}
console.log(new Intl.DateTimeFormat('jp', opt).format(new Date(2019, 0, 1, 13, 0, 0)));
const opt1 = {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
hour12: false,
minute: 'numeric',
second: 'numeric'
}
console.log(new Intl.DateTimeFormat('jp', opt1).format(Date.now()));
|