let currdate =2022-11-28T10:26:00.949Z
I have to convert the date like
28 Nov , 2022 :4:05:33 PM
Please suggest , tried some examples but not getting like this
Thanks
CodePudding user response:
The OP might have a look into the DateTimeFormat
formatter options of the ECMAScript Internationalization 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; }
CodePudding user response:
use moment.js for this
moment("2022-11-28T10:26:00.949Z").format("DD MMM , yyyy :h:mm:ss A")