use moment npm code example
Example 1: npm install moment
npm i moment --save
Example 2: npm moment
moment().format('MMMM Do YYYY, h:mm:ss a'); // March 5th 2021, 11:30:49 am
moment().format('dddd'); // Friday
moment().format("MMM Do YY"); // Mar 5th 21
moment().format('YYYY [escaped] YYYY'); // 2021 escaped 2021
moment().format('YYYY MM DD'); // 2021-03-05T11:30:49+05:30