skip to Main Content

I’m trying to format a Date String in React Native.
ex: 2nd NOV.
My problem is I have to show as it mention in the image.
enter image description here

2

Answers


  1. You could use MomentJS https://momentjs.com/ – it is a nice easy Library that lets you manipulate Dates and also Format it the way you want it. Check the "Display" Section in the Docs and there the "format" Function.

    I guess in your case it would look something like this:

    Moment(yourDate).format("DO MMM");
    
    Login or Signup to reply.
  2. A js alternative :

    new Date().toLocaleDateString('en', { day: 'numeric', month: 'short' })
    

    it would display the day and month according to the locale you choose

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search