设currdate =2022-11-28T10:26:00.949Z
I have to convert the date like
28 Nov , 2022 :4:05:33 PM请建议,试过几个例子,但不要这样
谢谢
发布于 2022-11-28 11:03:05
OP可能会查看ECMAScript国际化API的ECMAScript国际化API格式化程序选项。
const formatter = new Intl.DateTimeFormat('en-GB', {
year: 'numeric', month: '2-digit', day: '2-digit',
hour: 'numeric', minute: '2-digit', second: '2-digit',
hourCycle: 'h12',
});
console.log(
formatter
.format(
new Date('2022-11-28T10:26:00.949Z')
)
);.as-console-wrapper { min-height: 100%!important; top: 0; }
发布于 2022-11-28 10:38:38
为此使用moment.js
moment("2022-11-28T10:26:00.949Z").format("DD MMM , yyyy :h:mm:ss A")https://stackoverflow.com/questions/74599262
复制相似问题