G
G
Gregory2020-05-19 14:00:24
JavaScript
Gregory, 2020-05-19 14:00:24

How to convert the date '04/11/2020' to 'April 11'?

It is necessary date in the form of string can formatnut in a verbal type.

type from to
const oldDateString = '11.04.2020'
const formatedDateString = '11 апреля'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex Glebov, 2020-05-19
@Groyreg

There is moment.js
On pure js:

dateFormatter = (date) => {
  let dateStr = new Date(Date.parse(date)).toLocaleString('ru-RU', {  
    month: "long",
    day: "numeric"
  })
  return dateStr
}
dateFormatter('11.04.2020') //"4 ноября"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question