Home > Back-end >  Formatting date with moment js
Formatting date with moment js

Time:12-16

I am using moment js in react, how can I format date like this [2022m12d23] and [2022m12] ?

Thanks

CodePudding user response:

You could add square bracket between expected string for example [m] or [d]

The format as below

YYYY[m]MM[d]DD or YYYY[m]MM

Reference: https://momentjs.com/

  • Related